diff --git a/aoc_2021/src/day_03.rs b/aoc_2021/src/day_03.rs index 844b021..08bb4ea 100644 --- a/aoc_2021/src/day_03.rs +++ b/aoc_2021/src/day_03.rs @@ -50,12 +50,12 @@ impl Solution for Day03 { // Filter Oxygen let imax = get_imax(&oxygen_raw, i); oxygen_raw = gen_raw(oxygen_raw, num_len, &oxygen_keep); - oxygen_keep.retain(|x| x.chars().into_iter().nth(i).unwrap() == imax); + oxygen_keep.retain(|x| x.chars().nth(i).unwrap() == imax); // Filter Co2 let imax = get_imax(&co2_raw, i); co2_raw = gen_raw(co2_raw, num_len, &co2_keep); - co2_keep.retain(|x| x.chars().into_iter().nth(i).unwrap() != imax); + co2_keep.retain(|x| x.chars().nth(i).unwrap() != imax); if oxygen_keep.len() == 1 { oxygen_gen = isize::from_str_radix(oxygen_keep.first().unwrap(), 2).unwrap(); diff --git a/aoc_2021/src/day_10.rs b/aoc_2021/src/day_10.rs index 3a18f7f..0cb1b88 100644 --- a/aoc_2021/src/day_10.rs +++ b/aoc_2021/src/day_10.rs @@ -58,8 +58,7 @@ impl Solution for Day10 { if !is_corrupted { let mut score = 0; - while !queue.is_empty() { - let ch = queue.pop().unwrap(); + while let Some(ch) = queue.pop() { score = 5 * score + match ch { ')' => 1, diff --git a/aoc_2022/src/day_05.rs b/aoc_2022/src/day_05.rs index ddca8de..9dc88ac 100644 --- a/aoc_2022/src/day_05.rs +++ b/aoc_2022/src/day_05.rs @@ -8,11 +8,11 @@ impl Solution for Day05 { } fn part_a(&self, input: &str) -> Answer { - process(&input, true).into() + process(input, true).into() } fn part_b(&self, input: &str) -> Answer { - process(&input, false).into() + process(input, false).into() } } diff --git a/aoc_2022/src/day_18.rs b/aoc_2022/src/day_18.rs index e7035c6..62eedfb 100644 --- a/aoc_2022/src/day_18.rs +++ b/aoc_2022/src/day_18.rs @@ -56,7 +56,7 @@ const NEIGHBORS: [Point3; 6] = [ impl World { fn parse(raw: &str) -> Self { Self { - points: HashSet::from_iter(parse(raw).into_iter()), + points: HashSet::from_iter(parse(raw)), } } diff --git a/common/src/misc.rs b/common/src/misc.rs index 6dc1a4f..503ce96 100644 --- a/common/src/misc.rs +++ b/common/src/misc.rs @@ -9,5 +9,5 @@ pub fn load(year: u32, day: u32) -> io::Result { /// Load the input for the given year and day. pub fn load_raw(year: u32, day: u32) -> io::Result { let file = format!("data/{year}/{:02}.txt", day); - fs::read_to_string(&file) + fs::read_to_string(file) } diff --git a/scaffold/src/formatter.rs b/scaffold/src/formatter.rs index fae91f4..e4c92b1 100644 --- a/scaffold/src/formatter.rs +++ b/scaffold/src/formatter.rs @@ -10,7 +10,7 @@ pub struct Formatter { } #[derive(Debug)] -enum Component { +pub enum Component { Literal(String), Format { name: String, @@ -19,7 +19,7 @@ enum Component { } #[derive(Debug)] -enum Processor { +pub enum Processor { Pad { width: usize }, Uppercase, } diff --git a/scaffold/todo.md b/scaffold/todo.md index f5055f8..06a8914 100644 --- a/scaffold/todo.md +++ b/scaffold/todo.md @@ -1,11 +1,12 @@ # Todo -- [ ] Formatter -- [ ] Commands - - [ ] Init +- [x] Formatter +- [x] Commands + - [x] Init - [x] Scaffold - - [ ] Module + - [x] Module - [x] Input - [x] Verify - [x] Token - [x] Timer +- [ ] Allow not filling the solution array diff --git a/src/main.rs b/src/main.rs index 8e586ea..f5e412a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ fn get_year(year: u32) -> &'static [&'static dyn Solution] { match year { 2021 => &aoc_2021::ALL, 2022 => &aoc_2022::ALL, - 2023 => &aoc_2023::ALL, + 2023 => aoc_2023::ALL, _ => &[], } }