clippy
This commit is contained in:
parent
4dee357ea1
commit
c47f381a3b
|
@ -11,15 +11,15 @@ const DAY: usize = '$today';
|
|||
type Parsed = Vec<usize>;
|
||||
|
||||
fn parse_input(raw: &str) -> Parsed {
|
||||
unimplemented!()
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn part1(parsed: &Parsed) -> usize {
|
||||
unimplemented!()
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn part2(parsed: &Parsed) -> usize {
|
||||
unimplemented!()
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#![allow(unused)]
|
||||
#![feature(test)]
|
||||
extern crate test;
|
||||
use aoc2021::common::*;
|
||||
|
|
|
@ -60,12 +60,11 @@ fn step(grid: HashGrid<Pixel, 2>, lookup: &[Pixel; 512], iteration: usize) -> Ha
|
|||
const OUTSIDE: [Pixel; 2] = [Pixel::Dark, Pixel::Bright];
|
||||
|
||||
fn lookup_index(p: Position2D, grid: &HashGrid<Pixel, 2>, 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<Pixel, 2>, lookup: &[Pixel; 512], iterations: usize) -> usize {
|
||||
|
|
Loading…
Reference in New Issue
Block a user