Skip to content

Commit f7b0cfe

Browse files
authored
Merge pull request #2075 from senekor/remo/swzqnkxqzutw
Replace hashbrown with ahash
2 parents 4ce8667 + dc0ffbe commit f7b0cfe

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

Cargo.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ include = [
4646
]
4747

4848
[dependencies]
49+
ahash = "0.8.11"
4950
anyhow = "1.0.86"
5051
clap = { version = "4.5.13", features = ["derive"] }
51-
hashbrown = "0.14.5"
5252
notify-debouncer-mini = { version = "0.4.1", default-features = false }
5353
os_pipe = "1.2.1"
5454
ratatui = { version = "0.27.0", default-features = false, features = ["crossterm"] }

src/app_state.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use ahash::{HashSet, HashSetExt};
12
use anyhow::{bail, Context, Error, Result};
23
use std::{
34
fs::{self, File},
@@ -69,7 +70,7 @@ impl AppState {
6970
return StateFileStatus::NotRead;
7071
}
7172

72-
let mut done_exercises = hashbrown::HashSet::with_capacity(self.exercises.len());
73+
let mut done_exercises = HashSet::with_capacity(self.exercises.len());
7374

7475
for done_exerise_name in lines {
7576
if done_exerise_name.is_empty() {

src/dev/check.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use ahash::{HashSet, HashSetExt};
12
use anyhow::{anyhow, bail, Context, Error, Result};
23
use std::{
34
cmp::Ordering,
@@ -48,9 +49,9 @@ fn check_cargo_toml(
4849
}
4950

5051
// Check the info of all exercises and return their paths in a set.
51-
fn check_info_file_exercises(info_file: &InfoFile) -> Result<hashbrown::HashSet<PathBuf>> {
52-
let mut names = hashbrown::HashSet::with_capacity(info_file.exercises.len());
53-
let mut paths = hashbrown::HashSet::with_capacity(info_file.exercises.len());
52+
fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> {
53+
let mut names = HashSet::with_capacity(info_file.exercises.len());
54+
let mut paths = HashSet::with_capacity(info_file.exercises.len());
5455

5556
let mut file_buf = String::with_capacity(1 << 14);
5657
for exercise_info in &info_file.exercises {
@@ -111,10 +112,7 @@ fn check_info_file_exercises(info_file: &InfoFile) -> Result<hashbrown::HashSet<
111112
// Check `dir` for unexpected files.
112113
// Only Rust files in `allowed_rust_files` and `README.md` files are allowed.
113114
// Only one level of directory nesting is allowed.
114-
fn check_unexpected_files(
115-
dir: &str,
116-
allowed_rust_files: &hashbrown::HashSet<PathBuf>,
117-
) -> Result<()> {
115+
fn check_unexpected_files(dir: &str, allowed_rust_files: &HashSet<PathBuf>) -> Result<()> {
118116
let unexpected_file = |path: &Path| {
119117
anyhow!("Found the file `{}`. Only `README.md` and Rust files related to an exercise in `info.toml` are allowed in the `{dir}` directory", path.display())
120118
};
@@ -253,7 +251,7 @@ fn check_solutions(
253251
})
254252
.collect::<Vec<_>>();
255253

256-
let mut sol_paths = hashbrown::HashSet::with_capacity(info_file.exercises.len());
254+
let mut sol_paths = HashSet::with_capacity(info_file.exercises.len());
257255
let mut fmt_cmd = Command::new("rustfmt");
258256
fmt_cmd
259257
.arg("--check")

0 commit comments

Comments
 (0)