diff --git a/src/bin/2024/02.rs b/src/bin/2024/02.rs index fd7e1f4..c1b3145 100644 --- a/src/bin/2024/02.rs +++ b/src/bin/2024/02.rs @@ -1,6 +1,9 @@ -use advent_of_code::{strings::{convert_to_array, parsenumber}, KD}; #[allow(unused_imports)] use advent_of_code::{include_data, include_example}; +use advent_of_code::{ + strings::{convert_to_array, parsenumber}, + KD, +}; include_data!(DATA 2024 02); @@ -73,7 +76,7 @@ fn safe(record: Vec) -> bool { match (direction, last > level) { (KD::Top, false) | (KD::Bottom, true) => last = level, (KD::Top, true) | (KD::Bottom, false) => errors += 1, - _=>unreachable!() + _ => unreachable!(), } } if errors > 0 { diff --git a/src/bin/2024/03.rs b/src/bin/2024/03.rs index 134aa67..66aafd4 100644 --- a/src/bin/2024/03.rs +++ b/src/bin/2024/03.rs @@ -5,21 +5,21 @@ use regex::{Captures, Regex}; include_data!(DATA 2024 03); -fn parse_part1(input : Vec>) -> u32 { +fn parse_part1(input: Vec>) -> u32 { let mut sum = 0; - let (mut i,mut j): (u32, u32); + let (mut i, mut j): (u32, u32); for capture in input { i = parsenumber(capture.name("i").unwrap().as_str()); - j=parsenumber(capture.name("j").unwrap().as_str()); + j = parsenumber(capture.name("j").unwrap().as_str()); sum += i * j } sum } -fn parse_part2(input : Vec>)->u32 { +fn parse_part2(input: Vec>) -> u32 { let mut sum = 0; let mut parse = true; - let (mut i,mut j): (u32, u32); + let (mut i, mut j): (u32, u32); for capture in input { match (capture.get(1).unwrap().as_str(), parse) { ("do()", _) => parse = true,