diff --git a/aoc2021/src/day04.rs b/aoc2021/src/day04.rs index 1f5a4a6..2b0394e 100644 --- a/aoc2021/src/day04.rs +++ b/aoc2021/src/day04.rs @@ -46,7 +46,7 @@ fn part1(input: &str) -> Result { match (wdraw, wgrid) { (Some(draw), Some(grid)) => { - Ok(draw as u64 * grid.unmarked_numbers().map(|n| *n as u64).sum::()) + Ok(draw as u64 * grid.unmarked_numbers().map(|n| n as u64).sum::()) } _ => Err(anyhow!("couldn't find a winning grid!")), } @@ -89,7 +89,7 @@ fn part2(input: &str) -> Result { for draw in draws { if last_grid.mark(draw) { - return Ok(draw as u64 * last_grid.unmarked_numbers().map(|n| *n as u64).sum::()); + return Ok(draw as u64 * last_grid.unmarked_numbers().map(|n| n as u64).sum::()); } } @@ -120,10 +120,10 @@ impl Grid { } } - fn unmarked_numbers(&self) -> impl Iterator { + fn unmarked_numbers(&self) -> impl Iterator + '_ { self.number_to_pos .iter() - .filter_map(|(num, &(x, y))| (!self.access_grid(x, y)).then(|| num)) + .filter_map(|(num, &(x, y))| (!self.access_grid(x, y)).then(|| *num)) } fn access_grid(&self, x: usize, y: usize) -> bool {