diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5424945..f5205c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,5 +11,6 @@ repos: # Simply remove the comments (#) below for args and the flags you want. args: - --auto-add-tiles-to-git=amend + - --create-all-days # - --language-sorting=jl,kt,py,rs # - --exclude-patterns=2021/*/*.apl,2021/*/*.py,2021/*/*.cpp diff --git a/src/day3.rs b/src/day3.rs index a4d0109..19e9e9b 100644 --- a/src/day3.rs +++ b/src/day3.rs @@ -10,7 +10,7 @@ pub fn get_input(input: &[u8]) -> Vec { // PROBLEM 1 solution #[aoc(day3, part1)] -pub fn part1(input: &Vec) -> u64 { +pub fn part1(input: &[String]) -> u64 { let re = Regex::new(r"(?-u)mul\((\d+),(\d+)\)").unwrap(); input .iter() @@ -24,7 +24,7 @@ pub fn part1(input: &Vec) -> u64 { // PROBLEM 2 solution #[aoc(day3, part2)] -pub fn part2(input: &Vec) -> u64 { +pub fn part2(input: &[String]) -> u64 { let mut sum = 0u64; let mut do_mul: u64 = 1; let re = Regex::new(r"(?-u)(do\(\)|don't\(\)|mul\((\d+),(\d+)\))").unwrap(); diff --git a/src/day5.rs b/src/day5.rs index a4d9501..97ee9dd 100644 --- a/src/day5.rs +++ b/src/day5.rs @@ -65,10 +65,7 @@ impl OrderingRules { } } fn is_sorted(&self, a: u64, b: u64) -> bool { - match self.pairs.get(&(a, b)) { - Some(Ordering::Less) | Some(Ordering::Equal) => true, - _ => false, - } + matches!(self.pairs.get(&(a, b)), Some(Ordering::Less) | Some(Ordering::Equal)) } } diff --git a/src/lib.rs b/src/lib.rs index 8e6bccd..e77ce9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,5 +12,6 @@ pub mod day9; pub mod day10; pub mod day11; pub mod day12; +pub mod day13; aoc_lib! { year = 2024 } diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d733dc6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +use aoc_runner_derive::aoc_main; + +aoc_main!{ lib = aoc2024 } \ No newline at end of file