Skip to content

Commit

Permalink
Merge pull request #17 from mulkieran/issue_project_698
Browse files Browse the repository at this point in the history
Use once_cell instead of lazy_static for lazy statics
  • Loading branch information
mulkieran authored Apr 29, 2024
2 parents f89615b + f27e103 commit caf0746
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bindgen = { version = "0.69.0", default-features = false, features = ["runtime"]
[dev-dependencies]
glob = "0.3.0"
gpt = "3.0.0"
lazy_static = "1.4.0"
once_cell = "1.19.0"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68"
tempfile = "3.2.0"
5 changes: 2 additions & 3 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use libc::fallocate;
use once_cell::sync::Lazy;
use serde::{Deserialize, Deserializer};
use std::{
fs::OpenOptions,
Expand All @@ -13,9 +14,7 @@ use tempfile::{NamedTempFile, TempPath};

// All tests use the same loopback device interface and so can tread on each others toes leading to
// racy tests. So we need to lock all tests to ensure only one runs at a time.
lazy_static::lazy_static! {
static ref LOCK: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
}
static LOCK: Lazy<Arc<Mutex<()>>> = Lazy::new(|| Arc::new(Mutex::new(())));

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

0 comments on commit caf0746

Please sign in to comment.