From: =?utf-8?q?Felix_H=C3=A4cker?= Date: Sun, 8 Sep 2024 21:18:11 +0200 Subject: misc: Drop once cell crate (cherry picked from commit 68206590c9c0175b9c44c7d44051cd7360cd5b49) Origin: upstream, after 3.0.1 --- Cargo.toml | 1 - src/backend/connection_manager.rs | 4 ++-- src/path.rs | 10 ++++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 680083c..f820012 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ human-sort = "0.2" log = "0.4" magnet-uri = "0.2" nix = { version = ">= 0.29", features = ["signal"] } -once_cell = "1.19" pretty_env_logger = "0.5" regex = "1.10" oo7 = "0.3" diff --git a/src/backend/connection_manager.rs b/src/backend/connection_manager.rs index a9713f9..d747aeb 100644 --- a/src/backend/connection_manager.rs +++ b/src/backend/connection_manager.rs @@ -17,6 +17,7 @@ use std::cell::{Cell, RefCell}; use std::fs; use std::path::Path; +use std::sync::LazyLock; use std::time::Duration; use gio::prelude::*; @@ -25,7 +26,6 @@ use glib::subclass::Signal; use glib::{clone, Enum, KeyFile, Properties}; use gtk::subclass::prelude::*; use gtk::{gio, glib}; -use once_cell::sync::Lazy; use transmission_gobject::{ClientError, TrClient}; use crate::app::FrgApplication; @@ -124,7 +124,7 @@ mod imp { } fn signals() -> &'static [Signal] { - static SIGNALS: Lazy> = Lazy::new(|| { + static SIGNALS: LazyLock> = LazyLock::new(|| { vec![ Signal::builder("daemon-started").build(), Signal::builder("daemon-stopped") diff --git a/src/path.rs b/src/path.rs index 4f82142..0ccf543 100644 --- a/src/path.rs +++ b/src/path.rs @@ -16,15 +16,17 @@ use std::fs; use std::path::PathBuf; +use std::sync::LazyLock; use gtk::glib; -use once_cell::sync::Lazy; use crate::config; -pub static DATA: Lazy = Lazy::new(|| glib::user_data_dir().join(config::PKGNAME)); -pub static CONFIG: Lazy = Lazy::new(|| glib::user_config_dir().join(config::PKGNAME)); -pub static CACHE: Lazy = Lazy::new(|| glib::user_cache_dir().join(config::PKGNAME)); +pub static DATA: LazyLock = LazyLock::new(|| glib::user_data_dir().join(config::PKGNAME)); +pub static CONFIG: LazyLock = + LazyLock::new(|| glib::user_config_dir().join(config::PKGNAME)); +pub static CACHE: LazyLock = + LazyLock::new(|| glib::user_cache_dir().join(config::PKGNAME)); pub fn init() -> std::io::Result<()> { fs::create_dir_all(DATA.to_owned())?;