Skip to content

Commit 7e2f56f

Browse files
committed
Use the default hasher
1 parent e90f5f0 commit 7e2f56f

File tree

7 files changed

+10
-31
lines changed

7 files changed

+10
-31
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ include = [
4949
anyhow = "1.0.89"
5050
clap = { version = "4.5.20", features = ["derive"] }
5151
crossterm = { version = "0.28.1", default-features = false, features = ["windows", "events"] }
52-
foldhash = "0.1.3"
5352
notify = { version = "6.1.1", default-features = false, features = ["macos_fsevent"] }
5453
os_pipe = "1.2.1"
5554
rustlings-macros = { path = "rustlings-macros", version = "=6.3.0" }

clippy.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ disallowed-types = [
55
]
66

77
disallowed-methods = [
8-
# We use `foldhash` instead of the default hasher.
9-
"std::collections::HashSet::new",
10-
"std::collections::HashSet::with_capacity",
118
# Inefficient. Use `.queue(…)` instead.
129
"crossterm::style::style",
1310
# Use `thread::Builder::spawn` instead and handle the error.

src/app_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::{bail, Context, Error, Result};
22
use crossterm::{cursor, terminal, QueueableCommand};
33
use std::{
4+
collections::HashSet,
45
env,
56
fs::{File, OpenOptions},
67
io::{Read, Seek, StdoutLock, Write},
@@ -16,7 +17,6 @@ use std::{
1617
use crate::{
1718
clear_terminal,
1819
cmd::CmdRunner,
19-
collections::hash_set_with_capacity,
2020
embedded::EMBEDDED_FILES,
2121
exercise::{Exercise, RunnableExercise},
2222
info_file::ExerciseInfo,
@@ -146,7 +146,7 @@ impl AppState {
146146
break 'block StateFileStatus::NotRead;
147147
}
148148

149-
let mut done_exercises = hash_set_with_capacity(exercises.len());
149+
let mut done_exercises = HashSet::with_capacity(exercises.len());
150150

151151
for done_exercise_name in lines {
152152
if done_exercise_name.is_empty() {

src/collections.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/dev/check.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::{anyhow, bail, Context, Error, Result};
22
use std::{
33
cmp::Ordering,
4+
collections::HashSet,
45
fs::{self, read_dir, OpenOptions},
56
io::{self, Read, Write},
67
path::{Path, PathBuf},
@@ -11,7 +12,6 @@ use std::{
1112
use crate::{
1213
cargo_toml::{append_bins, bins_start_end_ind, BINS_BUFFER_CAPACITY},
1314
cmd::CmdRunner,
14-
collections::{hash_set_with_capacity, HashSet},
1515
exercise::{RunnableExercise, OUTPUT_CAPACITY},
1616
info_file::{ExerciseInfo, InfoFile},
1717
CURRENT_FORMAT_VERSION,
@@ -53,8 +53,8 @@ fn check_cargo_toml(
5353

5454
// Check the info of all exercises and return their paths in a set.
5555
fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> {
56-
let mut names = hash_set_with_capacity(info_file.exercises.len());
57-
let mut paths = hash_set_with_capacity(info_file.exercises.len());
56+
let mut names = HashSet::with_capacity(info_file.exercises.len());
57+
let mut paths = HashSet::with_capacity(info_file.exercises.len());
5858

5959
let mut file_buf = String::with_capacity(1 << 14);
6060
for exercise_info in &info_file.exercises {
@@ -282,7 +282,7 @@ fn check_solutions(
282282
.collect::<Result<Vec<_>, _>>()
283283
.context("Failed to spawn a thread to check a solution")?;
284284

285-
let mut sol_paths = hash_set_with_capacity(info_file.exercises.len());
285+
let mut sol_paths = HashSet::with_capacity(info_file.exercises.len());
286286
let mut fmt_cmd = Command::new("rustfmt");
287287
fmt_cmd
288288
.arg("--check")

src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use self::{app_state::AppState, dev::DevCommands, info_file::InfoFile};
1313
mod app_state;
1414
mod cargo_toml;
1515
mod cmd;
16-
mod collections;
1716
mod dev;
1817
mod embedded;
1918
mod exercise;

0 commit comments

Comments
 (0)