Skip to content

Commit 6fd8ddf

Browse files
committed
Small tidy
1 parent 06ad62e commit 6fd8ddf

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

src/util/hash.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//! resistant but slower hashing algorithm. [`FxHasher`] is much faster (between 2x to 5x from my testing).
77
use std::collections::{HashMap, HashSet};
88
use std::hash::{BuildHasher, Hash, Hasher};
9-
use std::ops::BitXor as _;
109

1110
/// Type alias for [`HashSet`] using [`FxHasher`].
1211
pub type FastSet<T> = HashSet<T, BuildFxHasher>;
@@ -92,7 +91,7 @@ pub struct FxHasher {
9291
impl FxHasher {
9392
#[inline]
9493
fn add(&mut self, i: u64) {
95-
self.hash = self.hash.rotate_left(5).bitxor(i).wrapping_mul(K);
94+
self.hash = (self.hash.rotate_left(5) ^ i).wrapping_mul(K);
9695
}
9796
}
9897

src/util/md5.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ pub mod simd {
297297
m: Simd<u32, N>,
298298
s: u32,
299299
k: u32,
300-
) -> Simd<u32, N>
301-
where {
300+
) -> Simd<u32, N> {
302301
let f = b ^ c ^ d;
303302
common(f, a, b, m, s, k)
304303
}
@@ -312,8 +311,7 @@ where {
312311
m: Simd<u32, N>,
313312
s: u32,
314313
k: u32,
315-
) -> Simd<u32, N>
316-
where {
314+
) -> Simd<u32, N> {
317315
let f = c ^ (b | !d);
318316
common(f, a, b, m, s, k)
319317
}
@@ -326,8 +324,7 @@ where {
326324
m: Simd<u32, N>,
327325
s: u32,
328326
k: u32,
329-
) -> Simd<u32, N>
330-
where {
327+
) -> Simd<u32, N> {
331328
let k = Simd::splat(k);
332329
let first = f + a + k + m;
333330
let second = (first << s) | (first >> (32 - s));

tests/year2016/day04.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ totally-real-room-200[decoy]";
1212
// order regardless of the order of skipped letters. Go with the looser interpretation, since
1313
// it gives slightly faster code, and no one has reported an input file where it fails. However,
1414
// when there is more than one higher-frequency letter, both should be in the checksum.
15-
const EXAMPLE2: &str = "\
15+
const SECOND_EXAMPLE: &str = "\
1616
a-b-c-d-e-f-g-h-001[bcdef]
1717
aa-bb-c-d-e-f-g-h-002[acdef]";
1818

1919
#[test]
2020
fn part1_test() {
2121
let input = parse(EXAMPLE);
2222
assert_eq!(part1(&input), 1514);
23-
let input = parse(EXAMPLE2);
23+
let input = parse(SECOND_EXAMPLE);
2424
assert_eq!(part1(&input), 1);
2525
}
2626

tests/year2024/day07.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const EXAMPLE: &str = "\
1111
21037: 9 7 18 13
1212
292: 11 6 16 20";
1313

14-
const EXAMPLE2: &str = "\
14+
const SECOND_EXAMPLE: &str = "\
1515
190: 10 19
1616
11174: 15 8 9 79 74
1717
729: 6 6 7 37 650";
@@ -20,14 +20,14 @@ const EXAMPLE2: &str = "\
2020
fn part1_test() {
2121
let input = parse(EXAMPLE);
2222
assert_eq!(part1(&input), 3749);
23-
let input2 = parse(EXAMPLE2);
23+
let input2 = parse(SECOND_EXAMPLE);
2424
assert_eq!(part1(&input2), 190);
2525
}
2626

2727
#[test]
2828
fn part2_test() {
2929
let input = parse(EXAMPLE);
3030
assert_eq!(part2(&input), 11387);
31-
let input2 = parse(EXAMPLE2);
31+
let input2 = parse(SECOND_EXAMPLE);
3232
assert_eq!(part2(&input2), 11364);
3333
}

tests/year2024/day24.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ fn part1_test() {
5757

5858
#[test]
5959
fn part2_test() {
60-
// No test
60+
// No example data
6161
}

tests/year2025/day11.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use aoc::year2025::day11::*;
22

3-
const EXAMPLE_ONE: &str = "\
3+
const FIRST_EXAMPLE: &str = "\
44
aaa: you hhh
55
you: bbb ccc
66
bbb: ddd eee
@@ -12,7 +12,7 @@ ggg: out
1212
hhh: ccc fff iii
1313
iii: out";
1414

15-
const EXAMPLE_TWO: &str = "\
15+
const SECOND_EXAMPLE: &str = "\
1616
svr: aaa bbb
1717
aaa: fft
1818
fft: ccc
@@ -29,12 +29,12 @@ hhh: out";
2929

3030
#[test]
3131
fn part1_test() {
32-
let input = parse(EXAMPLE_ONE);
32+
let input = parse(FIRST_EXAMPLE);
3333
assert_eq!(part1(&input), 5);
3434
}
3535

3636
#[test]
3737
fn part2_test() {
38-
let input = parse(EXAMPLE_TWO);
38+
let input = parse(SECOND_EXAMPLE);
3939
assert_eq!(part2(&input), 2);
4040
}

0 commit comments

Comments
 (0)