chore: use std::sync::LazyLock

Removes `once_cell` as a direct dependency.
This commit is contained in:
Vukašin Vojinović 2025-08-12 19:59:56 +02:00 committed by Michael Murphy
parent 467716c167
commit c3fafd3910
42 changed files with 77 additions and 106 deletions

View file

@ -27,8 +27,8 @@ use cosmic::iced_futures::futures::executor::block_on;
use cosmic_notifications_config::NotificationsConfig;
use cosmic_notifications_util::{ActionId, Image, Notification};
use cosmic_time::{anim, chain, id, once_cell::sync::Lazy, Instant, Timeline};
use std::{borrow::Cow, collections::HashMap, path::PathBuf};
use cosmic_time::{anim, chain, id, Instant, Timeline};
use std::{borrow::Cow, collections::HashMap, path::PathBuf, sync::LazyLock};
use subscriptions::notifications::{self, NotificationsAppletProxy};
use tokio::sync::mpsc::Sender;
use tracing::info;
@ -38,7 +38,7 @@ pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<Notifications>(())
}
static DO_NOT_DISTURB: Lazy<id::Toggler> = Lazy::new(id::Toggler::unique);
static DO_NOT_DISTURB: LazyLock<id::Toggler> = LazyLock::new(id::Toggler::unique);
struct Notifications {
core: cosmic::app::Core,

View file

@ -1,18 +1,18 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic_time::once_cell::sync::Lazy;
use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer,
};
use rust_embed::RustEmbed;
use std::sync::LazyLock;
#[derive(RustEmbed)]
#[folder = "i18n/"]
struct Localizations;
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| {
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
let loader: FluentLanguageLoader = fluent_language_loader!();
loader