1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
From: =?utf-8?q?Felix_H=C3=A4cker?= <haeckerfelix@gnome.org>
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 ea7411a..735939f 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<Vec<Signal>> = Lazy::new(|| {
+ static SIGNALS: LazyLock<Vec<Signal>> = 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<PathBuf> = Lazy::new(|| glib::user_data_dir().join(config::PKGNAME));
-pub static CONFIG: Lazy<PathBuf> = Lazy::new(|| glib::user_config_dir().join(config::PKGNAME));
-pub static CACHE: Lazy<PathBuf> = Lazy::new(|| glib::user_cache_dir().join(config::PKGNAME));
+pub static DATA: LazyLock<PathBuf> = LazyLock::new(|| glib::user_data_dir().join(config::PKGNAME));
+pub static CONFIG: LazyLock<PathBuf> =
+ LazyLock::new(|| glib::user_config_dir().join(config::PKGNAME));
+pub static CACHE: LazyLock<PathBuf> =
+ LazyLock::new(|| glib::user_cache_dir().join(config::PKGNAME));
pub fn init() -> std::io::Result<()> {
fs::create_dir_all(DATA.to_owned())?;
|