Skip to content

Commit a675cb5

Browse files
committed
Replace ahash with foldhash
1 parent baeeff3 commit a675cb5

File tree

4 files changed

+35
-68
lines changed

4 files changed

+35
-68
lines changed

Cargo.lock

Lines changed: 27 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ include = [
4646
]
4747

4848
[dependencies]
49-
ahash = { version = "0.8.11", default-features = false }
5049
anyhow = "1.0.89"
51-
clap = { version = "4.5.18", features = ["derive"] }
50+
clap = { version = "4.5.20", features = ["derive"] }
5251
crossterm = { version = "0.28.1", default-features = false, features = ["windows", "events"] }
52+
foldhash = "0.1.3"
5353
notify = { version = "6.1.1", default-features = false, features = ["macos_fsevent"] }
5454
os_pipe = "1.2.1"
5555
rustlings-macros = { path = "rustlings-macros", version = "=6.3.0" }
@@ -61,7 +61,7 @@ toml_edit.workspace = true
6161
rustix = { version = "0.38.37", default-features = false, features = ["std", "stdio", "termios"] }
6262

6363
[dev-dependencies]
64-
tempfile = "3.12.0"
64+
tempfile = "3.13.0"
6565

6666
[profile.release]
6767
panic = "abort"

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ disallowed-types = [
55
]
66

77
disallowed-methods = [
8-
# We use `ahash` instead of the default hasher.
8+
# We use `foldhash` instead of the default hasher.
99
"std::collections::HashSet::new",
1010
"std::collections::HashSet::with_capacity",
1111
# Inefficient. Use `.queue(…)` instead.

src/collections.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
use ahash::AHasher;
2-
use std::hash::BuildHasherDefault;
1+
use foldhash::fast::FixedState;
32

4-
/// DOS attacks aren't a concern for Rustlings. Therefore, we use `ahash` with fixed seeds.
5-
pub type HashSet<T> = std::collections::HashSet<T, BuildHasherDefault<AHasher>>;
3+
/// DOS attacks aren't a concern for Rustlings. Therefore, we use `foldhash` with a fixed state.
4+
pub type HashSet<T> = std::collections::HashSet<T, FixedState>;
65

76
#[inline]
87
pub fn hash_set_with_capacity<T>(capacity: usize) -> HashSet<T> {
9-
HashSet::with_capacity_and_hasher(capacity, BuildHasherDefault::<AHasher>::default())
8+
HashSet::with_capacity_and_hasher(capacity, FixedState::default())
109
}

0 commit comments

Comments
 (0)