Skip to content

Commit cf7cbeb

Browse files
authored
Merge pull request #458 from mulkieran/issue_project_833
Use std::sync::LazyLock instead of once_cell::Lazy
2 parents 60be64c + 51a821d commit cf7cbeb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ either = "1.6.1"
2323
libc = "0.2.155"
2424
bitflags = "2.3.1"
2525
log = "0.4.20"
26-
once_cell = "1.19.0"
2726
per-thread-mutex = "0.1.4"
2827
serde_json = "1.0.0"
2928

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ mod status;
3838
mod tests;
3939
mod wipe;
4040

41-
use once_cell::sync::Lazy;
42-
4341
#[cfg(cryptsetup23supported)]
4442
pub use crate::mem::{SafeBorrowedMemZero, SafeMemzero, SafeOwnedMemZero};
4543
pub use crate::{
@@ -78,11 +76,12 @@ pub use libc::{c_int, c_uint, size_t};
7876
pub type Result<T> = std::result::Result<T, LibcryptErr>;
7977

8078
#[cfg(feature = "mutex")]
81-
static MUTEX: Lazy<per_thread_mutex::PerThreadMutex> =
82-
Lazy::new(per_thread_mutex::PerThreadMutex::default);
79+
static MUTEX: std::sync::LazyLock<per_thread_mutex::PerThreadMutex> =
80+
std::sync::LazyLock::new(per_thread_mutex::PerThreadMutex::default);
8381

8482
#[cfg(not(feature = "mutex"))]
85-
static THREAD_ID: Lazy<std::thread::ThreadId> = Lazy::new(|| std::thread::current().id());
83+
static THREAD_ID: std::sync::LazyLock<std::thread::ThreadId> =
84+
std::sync::LazyLock::new(|| std::thread::current().id());
8685

8786
#[cfg(test)]
8887
mod test {

0 commit comments

Comments
 (0)