From c47f381a3bf32fdf3c3d5d33a43c364ee26a9f79 Mon Sep 17 00:00:00 2001 From: kageru Date: Tue, 21 Dec 2021 23:39:43 +0100 Subject: [PATCH] clippy --- 2021/setup_day.sh | 6 +++--- 2021/src/bin/day12.rs | 2 +- 2021/src/bin/day15.rs | 4 ++-- 2021/src/bin/day19.rs | 1 + 2021/src/bin/day20.rs | 5 ++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/2021/setup_day.sh b/2021/setup_day.sh index 97fc9d8..55e104d 100755 --- a/2021/setup_day.sh +++ b/2021/setup_day.sh @@ -11,15 +11,15 @@ const DAY: usize = '$today'; type Parsed = Vec; fn parse_input(raw: &str) -> Parsed { - unimplemented!() + todo!() } fn part1(parsed: &Parsed) -> usize { - unimplemented!() + todo!() } fn part2(parsed: &Parsed) -> usize { - unimplemented!() + todo!() } fn main() { diff --git a/2021/src/bin/day12.rs b/2021/src/bin/day12.rs index a93e8fc..8068956 100644 --- a/2021/src/bin/day12.rs +++ b/2021/src/bin/day12.rs @@ -44,7 +44,7 @@ fn part2(parsed: &Parsed) -> usize { possible_paths(parsed, &Node::Start, &Vec::new(), true) } -fn possible_paths<'a>(map: &'a Parsed, position: &'a Node<'a>, visited: &Vec<&'a Node<'a>>, small_cave_allowed: bool) -> usize { +fn possible_paths<'a>(map: &'a Parsed, position: &'a Node<'a>, visited: &[&'a Node<'a>], small_cave_allowed: bool) -> usize { map.get(position) .unwrap() .iter() diff --git a/2021/src/bin/day15.rs b/2021/src/bin/day15.rs index 8643135..44456bd 100644 --- a/2021/src/bin/day15.rs +++ b/2021/src/bin/day15.rs @@ -35,8 +35,8 @@ fn part1(parsed: &Parsed, grid_size: usize) -> usize { } } -fn part2(parsed: &Parsed) -> usize { - unimplemented!() +fn part2(_parsed: &Parsed) -> usize { + todo!() } fn main() { diff --git a/2021/src/bin/day19.rs b/2021/src/bin/day19.rs index 2e08bf3..cd35d7c 100644 --- a/2021/src/bin/day19.rs +++ b/2021/src/bin/day19.rs @@ -1,3 +1,4 @@ +#![allow(unused)] #![feature(test)] extern crate test; use aoc2021::common::*; diff --git a/2021/src/bin/day20.rs b/2021/src/bin/day20.rs index 6d447a2..4342765 100644 --- a/2021/src/bin/day20.rs +++ b/2021/src/bin/day20.rs @@ -60,12 +60,11 @@ fn step(grid: HashGrid, lookup: &[Pixel; 512], iteration: usize) -> Ha const OUTSIDE: [Pixel; 2] = [Pixel::Dark, Pixel::Bright]; fn lookup_index(p: Position2D, grid: &HashGrid, iteration: usize) -> usize { - let idx = neighbors_plus_self(p) + neighbors_plus_self(p) .into_iter() .rev() .map(|p| grid.get(&p).unwrap_or(&OUTSIDE[iteration & 1]) == &Pixel::Bright) - .fold(0, |acc, n| (acc << 1) | n as usize); - idx + .fold(0, |acc, n| (acc << 1) | n as usize) } fn step_times(grid: &HashGrid, lookup: &[Pixel; 512], iterations: usize) -> usize {