From 9714c5684912c930882f0bff9f34c8113e5c7e44 Mon Sep 17 00:00:00 2001 From: nokyan Date: Fri, 25 Oct 2024 15:16:06 +0200 Subject: [PATCH] Turn static LazyLock> to const &[_] --- src/utils/network.rs | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/utils/network.rs b/src/utils/network.rs index 839064a9..8c824afe 100644 --- a/src/utils/network.rs +++ b/src/utils/network.rs @@ -2,7 +2,6 @@ use std::{ ffi::OsString, fmt::Display, path::{Path, PathBuf}, - sync::LazyLock, }; use anyhow::{Context, Result}; @@ -16,23 +15,21 @@ use super::{ }; // this is a vec because we don't look for exact matches but for if the device name starts with a certain string -static INTERFACE_TYPE_MAP: LazyLock> = LazyLock::new(|| { - vec![ - ("bn", InterfaceType::Bluetooth), - ("br", InterfaceType::Bridge), - ("docker", InterfaceType::Docker), - ("eth", InterfaceType::Ethernet), - ("en", InterfaceType::Ethernet), - ("ib", InterfaceType::InfiniBand), - ("sl", InterfaceType::Slip), - ("veth", InterfaceType::VirtualEthernet), - ("virbr", InterfaceType::VmBridge), - ("vpn", InterfaceType::Vpn), - ("wg", InterfaceType::Wireguard), - ("wl", InterfaceType::Wlan), - ("ww", InterfaceType::Wwan), - ] -}); +const INTERFACE_TYPE_MAP: &[(&'static str, InterfaceType)] = &[ + ("bn", InterfaceType::Bluetooth), + ("br", InterfaceType::Bridge), + ("docker", InterfaceType::Docker), + ("eth", InterfaceType::Ethernet), + ("en", InterfaceType::Ethernet), + ("ib", InterfaceType::InfiniBand), + ("sl", InterfaceType::Slip), + ("veth", InterfaceType::VirtualEthernet), + ("virbr", InterfaceType::VmBridge), + ("vpn", InterfaceType::Vpn), + ("wg", InterfaceType::Wireguard), + ("wl", InterfaceType::Wlan), + ("ww", InterfaceType::Wwan), +]; #[derive(Debug)] pub struct NetworkData {