Skip to content

Commit

Permalink
Use std LazyLock instead of once_cell crate
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Jan 16, 2025
1 parent b259655 commit a428659
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ memmap2 = "0.9.0"
tokio = "1.23.0"
wayland-protocols = "0.32.1"
zbus = { version = "4.0.0", default-features = false, features = ["tokio"] }
once_cell = "1.18.0"
delegate = "0.13.0"
itertools = "0.14.0"
log = "0.4.20"
Expand Down
4 changes: 2 additions & 2 deletions src/localize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer,
};
use once_cell::sync::Lazy;
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
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use cosmic::{
use cosmic_comp_config::CosmicCompConfig;
use cosmic_config::{cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry};
use i18n_embed::DesktopLanguageRequester;
use once_cell::sync::Lazy;
use std::{
borrow::Cow,
collections::{HashMap, HashSet},
mem,
path::PathBuf,
str,
sync::LazyLock,
};

mod desktop_info;
Expand All @@ -57,11 +57,11 @@ struct CosmicWorkspacesConfig {
// Include `pid` in mime. Want to drag between our surfaces, but not another
// process, if we use Wayland object ids.
#[allow(dead_code)]
static WORKSPACE_MIME: Lazy<String> =
Lazy::new(|| format!("text/x.cosmic-workspace-id-{}", std::process::id()));
static WORKSPACE_MIME: LazyLock<String> =
LazyLock::new(|| format!("text/x.cosmic-workspace-id-{}", std::process::id()));

static TOPLEVEL_MIME: Lazy<String> =
Lazy::new(|| format!("text/x.cosmic-toplevel-id-{}", std::process::id()));
static TOPLEVEL_MIME: LazyLock<String> =
LazyLock::new(|| format!("text/x.cosmic-toplevel-id-{}", std::process::id()));

#[derive(Parser, Debug, Clone)]
#[command(author, version, about, long_about = None)]
Expand Down

0 comments on commit a428659

Please sign in to comment.