From 9048cd8f472c2126b3efc04c0c183f14b8ccde28 Mon Sep 17 00:00:00 2001 From: Falk Woldmann Lu <52786457+FalkWoldmann@users.noreply.github.com> Date: Mon, 11 Aug 2025 09:57:32 +0200 Subject: [PATCH] refactor: replace once_cell crate with std equivalent (#1260) --- Cargo.lock | 1 - Cargo.toml | 1 - src/main.rs | 8 ++++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f6db6a8..bb5f94bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2909,7 +2909,6 @@ dependencies = [ "merge", "nix 0.29.0", "notify-rust", - "once_cell", "parselnk", "regex", "regex-split", diff --git a/Cargo.toml b/Cargo.toml index c811f529..a5b40e8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ path = "src/main.rs" [dependencies] home = "~0.5" etcetera = "~0.8" -once_cell = "~1.19" serde = { version = "~1.0", features = ["derive"] } toml = "0.8" which_crate = { version = "~6.0", package = "which" } diff --git a/src/main.rs b/src/main.rs index 73355fec..2df07dd4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,8 +17,8 @@ use etcetera::base_strategy::BaseStrategy; use etcetera::base_strategy::Windows; #[cfg(unix)] use etcetera::base_strategy::Xdg; -use once_cell::sync::Lazy; use rust_i18n::{i18n, t}; +use std::sync::LazyLock; use tracing::debug; use self::config::{CommandLineArgs, Config}; @@ -50,12 +50,12 @@ mod sudo; mod terminal; mod utils; -pub(crate) static HOME_DIR: Lazy = Lazy::new(|| home::home_dir().expect("No home directory")); +pub(crate) static HOME_DIR: LazyLock = LazyLock::new(|| home::home_dir().expect("No home directory")); #[cfg(unix)] -pub(crate) static XDG_DIRS: Lazy = Lazy::new(|| Xdg::new().expect("No home directory")); +pub(crate) static XDG_DIRS: LazyLock = LazyLock::new(|| Xdg::new().expect("No home directory")); #[cfg(windows)] -pub(crate) static WINDOWS_DIRS: Lazy = Lazy::new(|| Windows::new().expect("No home directory")); +pub(crate) static WINDOWS_DIRS: LazyLock = LazyLock::new(|| Windows::new().expect("No home directory")); // Init and load the i18n files i18n!("locales", fallback = "en");