Skip to content

Commit 9ae0f88

Browse files
committed
Replace lazy_static with once_cell
1 parent 9b7abe4 commit 9ae0f88

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ default = ["serde_support"]
2323

2424
[dependencies]
2525
precomputed-hash = "0.1"
26-
lazy_static = "1.1.0"
26+
once_cell = "1.10.0"
2727
serde = { version = "1", optional = true }
2828
phf_shared = "0.10"
2929
new_debug_unreachable = "1.0.2"

src/dynamic_set.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
use lazy_static::lazy_static;
10+
use once_cell::sync::Lazy;
1111
use parking_lot::Mutex;
1212
use std::borrow::Cow;
1313
use std::mem;
@@ -38,16 +38,16 @@ fn entry_alignment_is_sufficient() {
3838
assert!(mem::align_of::<Entry>() >= ENTRY_ALIGNMENT);
3939
}
4040

41-
lazy_static! {
42-
pub(crate) static ref DYNAMIC_SET: Mutex<Set> = Mutex::new({
41+
pub(crate) static DYNAMIC_SET: Lazy<Mutex<Set>> = Lazy::new(|| {
42+
Mutex::new({
4343
type T = Option<Box<Entry>>;
4444
let _static_assert_size_eq = std::mem::transmute::<T, usize>;
4545
let vec = std::mem::ManuallyDrop::new(vec![0_usize; NB_BUCKETS]);
4646
Set {
4747
buckets: unsafe { Box::from_raw(vec.as_ptr() as *mut [T; NB_BUCKETS]) },
4848
}
49-
});
50-
}
49+
})
50+
});
5151

5252
impl Set {
5353
pub(crate) fn insert(&mut self, string: Cow<str>, hash: u32) -> NonNull<Entry> {

0 commit comments

Comments
 (0)