Advent of Code solutions in Rust

chore: fix new clippy lints

+8 -8
+1 -1
aoc_2017/src/day13.rs
··· 20 20 21 21 impl Layer { 22 22 fn will_catch(&self, delay: usize) -> bool { 23 - (self.depth + delay) % (2 * (self.range - 1)) == 0 23 + (self.depth + delay).is_multiple_of(2 * (self.range - 1)) 24 24 } 25 25 26 26 fn severity(&self) -> usize {
+1 -1
aoc_2017/src/day21.rs
··· 66 66 let dim = pic.shape()[0]; 67 67 if iterations == 0 { 68 68 pic.into_iter().filter(|&&x| x).count() 69 - } else if dim % 2 == 0 { 69 + } else if dim.is_multiple_of(2) { 70 70 let mut new_pic = ndarray::Array2::from_elem([dim / 2 * 3, dim / 2 * 3], false); 71 71 pic.exact_chunks((2, 2)) 72 72 .into_iter()
+1 -1
aoc_2022/src/day09.rs
··· 114 114 115 115 fn as_directions(motions: impl Iterator<Item = Motion>) -> impl Iterator<Item = Direction> { 116 116 motions 117 - .flat_map(|Motion { direction, length }| std::iter::repeat(direction).take(length as usize)) 117 + .flat_map(|Motion { direction, length }| std::iter::repeat_n(direction, length as usize)) 118 118 } 119 119 120 120 #[derive(Debug, Clone)]
+1 -1
aoc_2022/src/day11.rs
··· 162 162 } 163 163 164 164 fn divisible_by(&self, divisor: &u64) -> bool { 165 - self % divisor == 0 165 + self.is_multiple_of(*divisor) 166 166 } 167 167 168 168 fn apply(&self, op: &Operation) -> Self {
+1 -1
aoc_2024/src/day11.rs
··· 33 33 return Err(0); 34 34 } 35 35 let digits = r.ilog10() + 1; 36 - if digits % 2 == 0 { 36 + if digits.is_multiple_of(2) { 37 37 let half_pow = 10u64.pow(digits / 2); 38 38 Ok((r / half_pow, r % half_pow)) 39 39 } else {
+1 -1
aoc_2024/src/day12.rs
··· 89 89 .sum(); 90 90 91 91 assert!( 92 - total_vertex_value % 3 == 0, 92 + total_vertex_value.is_multiple_of(3), 93 93 "corner value should be divisible by three; got {total_vertex_value}" 94 94 ); 95 95
+2 -2
aoc_companion/src/validation.rs
··· 360 360 Ok(ValidationResult { 361 361 date: TEST_DAY, 362 362 part1: Ok(PartValidation { 363 - validity: GuessSubmitted(IncorrectTooHigh { .. }), 363 + validity: GuessSubmitted(IncorrectTooHigh), 364 364 .. 365 365 }), 366 366 part2: Ok(PartValidation { 367 - validity: GuessSubmitted(IncorrectTooManyGuesses { .. }), 367 + validity: GuessSubmitted(IncorrectTooManyGuesses), 368 368 .. 369 369 }) 370 370 })