Skip to content

Commit

Permalink
chore(deps): bump hashbrown to 0.15 (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Oct 4, 2024
1 parent b222822 commit 6877c03
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tiny-keccak = { version = "2.0", default-features = false }
sha3 = { version = "0.10.8", default-features = false }

# maps
hashbrown = { version = "0.14", default-features = false }
hashbrown = { version = "0.15", default-features = false }
indexmap = { version = "2.5", default-features = false }
rustc-hash = { version = "2.0", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ k256 = { workspace = true, optional = true, features = ["ecdsa"] }

# map
hashbrown = { workspace = true, optional = true, features = [
"ahash",
"default-hasher",
"inline-more",
] }
indexmap = { workspace = true, optional = true }
Expand Down
12 changes: 11 additions & 1 deletion crates/primitives/src/map/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,22 @@ impl<const N: usize> BuildHasher for FbBuildHasher<N> {
/// Works best with `fxhash`, enabled by default with the "map-fxhash" feature.
///
/// **NOTE:** this hasher accepts only `N`-length byte arrays! It is invalid to hash anything else.
#[derive(Clone, Default)]
#[derive(Clone)]
pub struct FbHasher<const N: usize> {
inner: DefaultHasher,
_marker: core::marker::PhantomData<[(); N]>,
}

impl<const N: usize> Default for FbHasher<N> {
#[inline]
fn default() -> Self {
Self {
inner: DefaultHashBuilder::default().build_hasher(),
_marker: core::marker::PhantomData,
}
}
}

impl<const N: usize> fmt::Debug for FbHasher<N> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("FbHasher").finish_non_exhaustive()
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ cfg_if! {
if #[cfg(feature = "map-fxhash")] {
type DefaultHashBuilderInner = FxBuildHasher;
} else if #[cfg(any(feature = "map-hashbrown", not(feature = "std")))] {
type DefaultHashBuilderInner = hashbrown::hash_map::DefaultHashBuilder;
type DefaultHashBuilderInner = hashbrown::DefaultHashBuilder;
} else {
type DefaultHashBuilderInner = std::collections::hash_map::RandomState;
}
Expand Down
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ allow = [
"Unicode-DFS-2016",
"Unlicense",
"MPL-2.0",
"Zlib",
# https://github.com/briansmith/ring/issues/902
"LicenseRef-ring",
# https://github.com/briansmith/webpki/issues/148
Expand Down

0 comments on commit 6877c03

Please sign in to comment.