Skip to content

Commit

Permalink
Replace once_cell::sync::OnceCell with std::sync::OnceLock
Browse files Browse the repository at this point in the history
  • Loading branch information
xacrimon committed Feb 13, 2025
1 parent fca0bd1 commit 95e3cc6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ hashbrown = { version = "0.15.2", default-features = false }
serde = { version = "1.0.217", optional = true, features = ["derive"] }
cfg-if = "1.0.0"
rayon = { version = "1.10.0", optional = true }
once_cell = "1.20.3"
arbitrary = { version = "1.4.1", optional = true }
crossbeam-utils = "0.8"
typesize = { version = "0.1.11", default-features = false, optional = true }
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ use lock::{RwLockReadGuardDetached, RwLockWriteGuardDetached};
pub use mapref::entry::{Entry, OccupiedEntry, VacantEntry};
use mapref::multiple::RefMulti;
use mapref::one::{Ref, RefMut};
use once_cell::sync::OnceCell;
pub use read_only::ReadOnlyView;
pub use set::DashSet;
use std::collections::hash_map::RandomState;
use std::sync::OnceLock;
use try_result::TryResult;

pub(crate) type HashMap<K, V> = hash_table::HashTable<(K, V)>;
Expand All @@ -58,7 +58,7 @@ pub(crate) type HashMap<K, V> = hash_table::HashTable<(K, V)>;
pub struct TryReserveError {}

fn default_shard_amount() -> usize {
static DEFAULT_SHARD_AMOUNT: OnceCell<usize> = OnceCell::new();
static DEFAULT_SHARD_AMOUNT: OnceLock<usize> = OnceLock::new();
*DEFAULT_SHARD_AMOUNT.get_or_init(|| {
(std::thread::available_parallelism().map_or(1, usize::from) * 4).next_power_of_two()
})
Expand Down

0 comments on commit 95e3cc6

Please sign in to comment.