Debian Codegraph @

debian/patches/misc-Drop-once-cell-crate.patch

raw
1 From: =?utf-8?q?Felix_H=C3=A4cker?= <[email protected]>
2 Date: Sun, 8 Sep 2024 21:18:11 +0200
3 Subject: misc: Drop once cell crate
4
5 (cherry picked from commit 68206590c9c0175b9c44c7d44051cd7360cd5b49)
6
7 Origin: upstream, after 3.0.1
8 ---
9 Cargo.toml | 1 -
10 src/backend/connection_manager.rs | 4 ++--
11 src/path.rs | 10 ++++++----
12 3 files changed, 8 insertions(+), 7 deletions(-)
13
14 diff --git a/Cargo.toml b/Cargo.toml
15 index 680083c..f820012 100644
16 --- a/Cargo.toml
17 +++ b/Cargo.toml
18 @@ -17,7 +17,6 @@ human-sort = "0.2"
19 log = "0.4"
20 magnet-uri = "0.2"
21 nix = { version = ">= 0.29", features = ["signal"] }
22 -once_cell = "1.19"
23 pretty_env_logger = "0.5"
24 regex = "1.10"
25 oo7 = "0.3"
26 diff --git a/src/backend/connection_manager.rs b/src/backend/connection_manager.rs
27 index a9713f9..d747aeb 100644
28 --- a/src/backend/connection_manager.rs
29 +++ b/src/backend/connection_manager.rs
30 @@ -17,6 +17,7 @@
31 use std::cell::{Cell, RefCell};
32 use std::fs;
33 use std::path::Path;
34 +use std::sync::LazyLock;
35 use std::time::Duration;
36
37 use gio::prelude::*;
38 @@ -25,7 +26,6 @@ use glib::subclass::Signal;
39 use glib::{clone, Enum, KeyFile, Properties};
40 use gtk::subclass::prelude::*;
41 use gtk::{gio, glib};
42 -use once_cell::sync::Lazy;
43 use transmission_gobject::{ClientError, TrClient};
44
45 use crate::app::FrgApplication;
46 @@ -124,7 +124,7 @@ mod imp {
47 }
48
49 fn signals() -> &'static [Signal] {
50 - static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
51 + static SIGNALS: LazyLock<Vec<Signal>> = LazyLock::new(|| {
52 vec![
53 Signal::builder("daemon-started").build(),
54 Signal::builder("daemon-stopped")
55 diff --git a/src/path.rs b/src/path.rs
56 index 4f82142..0ccf543 100644
57 --- a/src/path.rs
58 +++ b/src/path.rs
59 @@ -16,15 +16,17 @@
60
61 use std::fs;
62 use std::path::PathBuf;
63 +use std::sync::LazyLock;
64
65 use gtk::glib;
66 -use once_cell::sync::Lazy;
67
68 use crate::config;
69
70 -pub static DATA: Lazy<PathBuf> = Lazy::new(|| glib::user_data_dir().join(config::PKGNAME));
71 -pub static CONFIG: Lazy<PathBuf> = Lazy::new(|| glib::user_config_dir().join(config::PKGNAME));
72 -pub static CACHE: Lazy<PathBuf> = Lazy::new(|| glib::user_cache_dir().join(config::PKGNAME));
73 +pub static DATA: LazyLock<PathBuf> = LazyLock::new(|| glib::user_data_dir().join(config::PKGNAME));
74 +pub static CONFIG: LazyLock<PathBuf> =
75 + LazyLock::new(|| glib::user_config_dir().join(config::PKGNAME));
76 +pub static CACHE: LazyLock<PathBuf> =
77 + LazyLock::new(|| glib::user_cache_dir().join(config::PKGNAME));
78
79 pub fn init() -> std::io::Result<()> {
80 fs::create_dir_all(DATA.to_owned())?;