diff --git a/2025/src/day10.rs b/2025/src/day10.rs index cf656aa..e8f4760 100644 --- a/2025/src/day10.rs +++ b/2025/src/day10.rs @@ -1,6 +1,5 @@ use std::{ collections::{BinaryHeap, VecDeque}, - hash::Hash, iter::{repeat, repeat_n}, }; @@ -73,8 +72,8 @@ impl From<&str> for MachineDefinition { MachineDefinition { desired: parts["desired"].chars().map(|c| c == '#').collect(), - buttons: buttons, - buttons2: buttons2, + buttons, + buttons2, buttons_max: i16x16::new(buttons_max), joltages: i16x16::new(joltages), } @@ -127,7 +126,7 @@ impl<'a> JoltMachine<'a> { // // new_joltage[*jolt] += 1; // // } let new_joltage = self.joltages + self.d.buttons2[button]; - let mut new_presses = presses.clone(); + let mut new_presses = *presses; new_presses.as_mut_array()[button] += 1; if new_joltage == self.d.joltages { (new_presses, None) @@ -147,7 +146,7 @@ impl<'a> JoltMachine<'a> { .buttons .iter() .enumerate() - .map(|(i, _but)| self.press_jolts(i, &presses)) + .map(|(i, _but)| self.press_jolts(i, presses)) // .inspect(|(p, o)| println!(" {p:?} {o:?}\n")) // joltages monotonically increase, so cull any where a joltage is higher than needed .filter(|(presses, candidate)| { @@ -246,7 +245,7 @@ fn find_best_jolts(md: &MachineDefinition) -> usize { machine: m, }); - let mut pb = ProgressBar::no_length() + let pb = ProgressBar::no_length() .with_style( ProgressStyle::with_template( "[{elapsed_precise}/{eta_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {per_sec}", diff --git a/2025/src/day12.rs b/2025/src/day12.rs index b4e632a..e3d5e83 100644 --- a/2025/src/day12.rs +++ b/2025/src/day12.rs @@ -1,8 +1,6 @@ use aoc_runner_derive::{aoc, aoc_generator}; use grid::{Coord2d, Grid, MirrorAxis}; -use indicatif::{ProgressBar, ProgressStyle}; use itertools::Itertools; -use rayon::iter::IntoParallelRefIterator; use std::collections::HashSet; use std::fmt::Display; use std::iter::repeat_n; @@ -139,10 +137,9 @@ impl PresentsProblem { y: y as i64, }, i, - ) { - if self.place_next(new_t, cur + 1, cache) { - return true; - } + ) && self.place_next(new_t, cur + 1, cache) + { + return true; } } } diff --git a/2025/src/day9.rs b/2025/src/day9.rs index 8d4a7f6..73e4edb 100644 --- a/2025/src/day9.rs +++ b/2025/src/day9.rs @@ -22,7 +22,7 @@ fn parse(input: &str) -> Vec { } #[aoc(day9, part1)] -fn part1(input: &Vec) -> u64 { +fn part1(input: &[Coord2d]) -> u64 { input .iter() .tuple_combinations() @@ -62,6 +62,7 @@ fn build_grid(reds: &Vec) -> Grid { grid } +#[allow(unused)] fn build_hashgrid(reds: &Vec) -> HashMap { let mut grid = HashMap::new(); let mut prev = reds.last().unwrap(); @@ -88,6 +89,7 @@ fn build_hashgrid(reds: &Vec) -> HashMap { grid } +#[allow(unused)] fn flood_fill(grid: &mut Grid, pos: Coord2d) { if grid.get(&pos) != Some(&b'.') { return; @@ -109,6 +111,7 @@ fn flood_fill(grid: &mut Grid, pos: Coord2d) { } } +#[allow(unused)] fn flood_scan(grid: &mut Grid, lx: i64, rx: i64, y: i64, q: &mut VecDeque) { let mut span_added = false; for x in lx..rx { @@ -121,6 +124,7 @@ fn flood_scan(grid: &mut Grid, lx: i64, rx: i64, y: i64, q: &mut VecDeque) -> u64 { let mut grid = build_grid(reds); @@ -162,10 +166,11 @@ fn part2(reds: &Vec) -> u64 { (a.x().abs_diff(b.x()) + 1) * (a.y().abs_diff(b.y()) + 1) } -fn line_square_intersection(&(l1, l2): &(<, <), &(sq1, sq2): &(&ST, &ST)) -> bool +#[allow(unused)] +fn line_square_intersection(&(l1, l2): &(<, <), &(sq1, sq2): &(&ST, &ST)) -> bool where - LT: Clone + Display, - ST: Clone + Display, + LT: Clone + Display + AsCoord2d, + ST: Clone + Display + AsCoord2d, { let min_x = min(sq1.x(), sq2.x()); let max_x = max(sq1.x(), sq2.x()); @@ -216,6 +221,7 @@ where trait Rectangle { fn top_left(&self) -> Coord2d; fn bottom_right(&self) -> Coord2d; + #[allow(unused)] fn in_bounds(&self, b: &T) -> bool { b.x() >= self.top_left().x && b.x() <= self.bottom_right().x() @@ -245,6 +251,7 @@ impl Rectangle for (&Coord2d, &Coord2d) { } // true = clockwise +#[allow(unused)] fn outside_points(prev: &Coord2d, cur: &Coord2d, next: &Coord2d) -> Vec { let l1_diff = ((cur.x - prev.x).signum(), (cur.y - prev.y).signum()); let l2_diff = ((next.x - cur.x).signum(), (next.y - cur.y).signum()); @@ -269,7 +276,7 @@ fn outside_points(prev: &Coord2d, cur: &Coord2d, next: &Coord2d) -> Vec } #[aoc(day9, part2, Lines)] -fn part2_lines(reds: &Vec) -> u64 { +fn part2_lines(reds: &[Coord2d]) -> u64 { // let mut grid = build_hashgrid(reds); // let mut grid = build_grid(reds); // // println!("{grid}");