Skip to content

Commit 73fd732

Browse files
committed
chore: use 0_usize instead of 0usize, use zero() instead of T::zero()
1 parent 4679b7f commit 73fd732

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

aoclp_solutions/src/y2017/day_03.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn spiral() -> impl Iterator<Item = Pt> {
4545

4646
fn spiral_stress_test() -> impl Iterator<Item = i64> {
4747
let mut values = HashMap::new();
48-
let around: Vec<_> = (-1i64..=1)
49-
.cartesian_product(-1i64..=1)
48+
let around: Vec<_> = (-1_i64..=1)
49+
.cartesian_product(-1_i64..=1)
5050
.map_into::<Pt>()
5151
.filter(|pt| !pt.is_zero())
5252
.collect();
@@ -59,7 +59,7 @@ fn spiral_stress_test() -> impl Iterator<Item = i64> {
5959
values.get(&neighbour).copied()
6060
})
6161
.sum1()
62-
.unwrap_or(1i64);
62+
.unwrap_or(1_i64);
6363
values.insert(pt, value);
6464
value
6565
})

aoclp_solutions/src/y2017/day_11.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::iter::successors;
22

3-
use aoclp::num::{Zero, zero};
3+
use aoclp::num::zero;
44
use aoclp::positioning::pt::{Pt, manhattan};
55
use aoclp::solvers_impl::input::safe_get_input_as_one_vec;
66
use itertools::Itertools;
@@ -12,7 +12,7 @@ pub fn part_1() -> usize {
1212

1313
pub fn part_2() -> usize {
1414
child_path()
15-
.sorted_by_key(|pt| -manhattan(Pt::zero(), *pt))
15+
.sorted_by_key(|pt| -manhattan(zero(), *pt))
1616
.map(distance_to)
1717
.next()
1818
.unwrap()

aoclp_solutions/src/y2017/day_13.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn part_1() -> usize {
1010

1111
pub fn part_2() -> usize {
1212
let input = input();
13-
(1usize..)
13+
(1_usize..)
1414
.find(|delay| !input.iter().any(|layer| layer.catches(*delay)))
1515
.unwrap()
1616
}

aoclp_solutions/src/y2017/day_18.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn part_2() -> usize {
3939
),
4040
];
4141

42-
let mut interpreter = 0usize;
42+
let mut interpreter = 0_usize;
4343
let mut wait_count = 0;
4444
loop {
4545
let next_interpreter = &mut interpreters[interpreter];

aoclp_solutions/src/y2017/helpers/knot_hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl KnotHash {
5050
.cycle()
5151
.take(num_lengths)
5252
.map(|&length| length as usize)
53-
.fold((numbers.iter().cycle(), 0usize), |(numbers, skip), length| {
53+
.fold((numbers.iter().cycle(), 0_usize), |(numbers, skip), length| {
5454
Self::swap_range(numbers.clone().take(length));
5555
(numbers.dropping(length + skip), skip + 1)
5656
});

aoclp_solutions/src/y2024/day_02.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn safe(levels: &Vec<i64>) -> bool {
2121
let signum = (levels[0] - levels[1]).signum();
2222
levels.iter().tuple_windows().all(|(a, b)| {
2323
let new_diff = a - b;
24-
new_diff.signum() == signum && (1i64..=3).contains(&new_diff.abs())
24+
new_diff.signum() == signum && (1_i64..=3).contains(&new_diff.abs())
2525
})
2626
}
2727

aoclp_solutions/src/y2025/day_02.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn num_digits(n: usize) -> usize {
4444
fn invalid(id: usize) -> bool {
4545
let num_digits = num_digits(id);
4646
if num_digits.is_even() {
47-
let midpoint = 10usize.pow(num_digits as u32 / 2);
47+
let midpoint = 10_usize.pow(num_digits as u32 / 2);
4848
return (id / midpoint) == (id % midpoint);
4949
}
5050

@@ -58,7 +58,7 @@ fn invalid_fancy(id: usize) -> bool {
5858

5959
fn invalid_of_size(mut id: usize, num_digits: usize, of_size: usize) -> bool {
6060
if num_digits % of_size == 0 {
61-
let window = 10usize.pow(of_size as u32);
61+
let window = 10_usize.pow(of_size as u32);
6262
let expected = id % window;
6363
while id != 0 {
6464
let actual = id % window;

aoclp_solutions/src/y2025/day_08.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn part_2() -> i64 {
2222
fn circuits(all: bool) -> (HashMap<Pt3d, usize>, HashMap<usize, usize>, (Pt3d, Pt3d)) {
2323
let boxes = input();
2424

25-
let mut circuit_id = 0usize;
25+
let mut circuit_id = 0_usize;
2626
let mut circuits = HashMap::new();
2727
let mut circuit_sizes = HashMap::new();
2828
let mut last_pair = (zero(), zero());
@@ -57,7 +57,7 @@ fn circuits(all: bool) -> (HashMap<Pt3d, usize>, HashMap<usize, usize>, (Pt3d, P
5757
(None, None) => {
5858
circuits.insert(a, circuit_id);
5959
circuits.insert(b, circuit_id);
60-
circuit_sizes.insert(circuit_id, 2usize);
60+
circuit_sizes.insert(circuit_id, 2_usize);
6161
circuit_id += 1;
6262
},
6363
});

codingquest_clp_solutions/src/problem_16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Message {
5959
{
6060
let actual_checksum = data
6161
.into_iter()
62-
.fold(0u8, |acc, byte| acc.wrapping_add(byte));
62+
.fold(0_u8, |acc, byte| acc.wrapping_add(byte));
6363
actual_checksum.wrapping_sub(expected_checksum)
6464
}
6565
}

0 commit comments

Comments
 (0)