chore: use LazyLock instead of lazy_static!

This commit is contained in:
Doods 2025-07-13 15:50:37 +03:00
parent a20d77fea4
commit 97027e69c3
4 changed files with 15 additions and 23 deletions

View file

@ -33,9 +33,11 @@ use std::{
any::TypeId,
cmp,
collections::{BTreeMap, BTreeSet, HashMap},
env, fs, process,
env,
error::Error,
fs, process,
rc::Rc,
sync::{atomic::Ordering, Mutex},
sync::{atomic::Ordering, LazyLock, Mutex},
};
use tokio::sync::mpsc;
@ -71,11 +73,7 @@ mod dnd;
use clap_lex::RawArgs;
use std::error::Error;
lazy_static::lazy_static! {
static ref ICON_CACHE: Mutex<IconCache> = Mutex::new(IconCache::new());
}
static ICON_CACHE: LazyLock<Mutex<IconCache>> = LazyLock::new(|| Mutex::new(IconCache::new()));
pub fn icon_cache_get(name: &'static str, size: u16) -> widget::icon::Icon {
let mut icon_cache = ICON_CACHE.lock().unwrap();