diff --git a/Cargo.toml b/Cargo.toml index 7a9e393..f37d1e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,6 @@ grev = "0.1.3" anyhow = "1.0.68" clap = {version = "4.1.4", features = ["derive"]} clap_complete = {version = "4.1.1", optional = true} -once_cell = "1.17.0" regex = {version = "1.7.1", default-features = false, features = ["std"]} tempfile = {version = "3.3.0", optional = true} time = {version = "0.3.18", features = ["formatting", "local-offset", "parsing"]} diff --git a/src/btrfs/btrfs.rs b/src/btrfs/btrfs.rs index 84e250f..251e502 100644 --- a/src/btrfs/btrfs.rs +++ b/src/btrfs/btrfs.rs @@ -13,12 +13,11 @@ use std::path::PathBuf; use std::str::FromStr as _; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; +use std::sync::LazyLock; use anyhow::Context as _; use anyhow::Result; -use once_cell::sync::Lazy; - use regex::Regex; use crate::ops::FileOps; @@ -40,7 +39,7 @@ const PATH_STRING: &str = r".+"; /// by the snapshots() method. Each line is expected to be following the /// pattern: /// ID A gen B top level C path PATH -static SNAPSHOTS_LINE_REGEX: Lazy = Lazy::new(|| { +static SNAPSHOTS_LINE_REGEX: LazyLock = LazyLock::new(|| { Regex::new(&format!( r"^ID {NUMS_STRING} gen (?P{NUMS_STRING}) top level {NUMS_STRING} path (?P{PATH_STRING})$" )).expect("failed to create snapshot regular expression") diff --git a/src/snapshot.rs b/src/snapshot.rs index fdf5e50..8a35393 100644 --- a/src/snapshot.rs +++ b/src/snapshot.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2023 Daniel Mueller +// Copyright (C) 2023-2024 Daniel Mueller // SPDX-License-Identifier: GPL-3.0-or-later use std::borrow::Cow; @@ -10,13 +10,12 @@ use std::fmt::Result as FmtResult; use std::path::Path; use std::path::MAIN_SEPARATOR; use std::str::FromStr as _; +use std::sync::LazyLock; use anyhow::ensure; use anyhow::Context as _; use anyhow::Result; -use once_cell::sync::Lazy; - use time::format_description::modifier::Day; use time::format_description::modifier::Hour; use time::format_description::modifier::Minute; @@ -52,7 +51,7 @@ const ENCODED_INTRA_COMPONENT_SEPARATOR: &str = "-"; const ENCODED_COMPONENT_SEPARATOR: &str = "_"; /// The UTC time zone offset we use throughout the program. -static UTC_OFFSET: Lazy = Lazy::new(|| { +static UTC_OFFSET: LazyLock = LazyLock::new(|| { if cfg!(test) || cfg!(feature = "test") { // SAFETY: Our tests do not mutate the environment. let () = unsafe { set_soundness(Soundness::Unsound) };