From 32772648ad5a6995747a0380da93981d6b72e1e7 Mon Sep 17 00:00:00 2001 From: GyulyVGC Date: Sun, 24 Nov 2024 15:06:41 +0100 Subject: [PATCH] fix clippy::pedantic lint --- src/configs/types/configs.rs | 5 +++-- src/main.rs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/configs/types/configs.rs b/src/configs/types/configs.rs index cc9e061a..79a79351 100644 --- a/src/configs/types/configs.rs +++ b/src/configs/types/configs.rs @@ -1,7 +1,7 @@ use crate::{ConfigDevice, ConfigSettings, ConfigWindow}; use once_cell::sync::Lazy; -pub static CONFIGS: Lazy = Lazy::new(|| Configs::load()); +pub static CONFIGS: Lazy = Lazy::new(Configs::load); #[derive(Default, Clone, PartialEq, Debug)] pub struct Configs { @@ -11,7 +11,8 @@ pub struct Configs { } impl Configs { - /// This shouldn't be used directly outside tests, use `CONFIGS` instead + /// This should only be used directly to load fresh configs; + /// use `CONFIGS` instead to access the initial instance pub fn load() -> Self { Configs { settings: ConfigSettings::load(), diff --git a/src/main.rs b/src/main.rs index b9c2ea4b..9811672d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,9 +55,11 @@ pub const SNIFFNET_TITLECASE: &str = "Sniffnet"; /// /// It initializes shared variables and loads configuration parameters pub fn main() -> iced::Result { + let configs = CONFIGS.clone(); + let boot_task_chain = parse_cli_args(); - let configs1 = Arc::new(Mutex::new(CONFIGS.clone())); + let configs1 = Arc::new(Mutex::new(configs)); let configs2 = configs1.clone(); let newer_release_available1 = Arc::new(Mutex::new(None));