Skip to content

Commit ccd64ba

Browse files
committed
Use std::sync::LazyLock instead of once_cell::Lazy
Generally better to use the library standard facility rather than an external crate where possible. LazyLock was introduced in version 1.80.0 of the Rust standard library. Signed-off-by: mulhern <[email protected]>
1 parent 5cba75e commit ccd64ba

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ bindgen = "0.72.0"
2929
[dev-dependencies]
3030
glob = "0.3.0"
3131
gpt = "3.0.0"
32-
once_cell = "1.19.0"
3332
serde = { version = "1.0.130", features = ["derive"] }
3433
serde_json = "1.0.68"
3534
tempfile = "3.4.0"

tests/util/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use libc::fallocate;
2-
use once_cell::sync::Lazy;
32
use serde::{Deserialize, Deserializer};
43
use std::{
4+
sync::LazyLock,
55
fs::OpenOptions,
66
io,
77
os::unix::io::AsRawFd,
@@ -14,7 +14,7 @@ use tempfile::{NamedTempFile, TempPath};
1414

1515
// All tests use the same loopback device interface and so can tread on each others toes leading to
1616
// racy tests. So we need to lock all tests to ensure only one runs at a time.
17-
static LOCK: Lazy<Arc<Mutex<()>>> = Lazy::new(|| Arc::new(Mutex::new(())));
17+
static LOCK: LazyLock<Arc<Mutex<()>>> = LazyLock::new(|| Arc::new(Mutex::new(())));
1818

1919
pub fn create_backing_file(size: i64) -> TempPath {
2020
let file = NamedTempFile::new().expect("should be able to create a temp file");

0 commit comments

Comments
 (0)