From 74a6b16924d85d0db4154a25c5ff2e22940f69f8 Mon Sep 17 00:00:00 2001 From: Keenan Tims Date: Fri, 13 Dec 2024 23:06:02 -0800 Subject: [PATCH] chore: rust fmt --- src/day1.rs | 2 +- src/day4.rs | 10 ++++++++-- src/main.rs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/day1.rs b/src/day1.rs index b1aaa5b..a0f909b 100644 --- a/src/day1.rs +++ b/src/day1.rs @@ -89,4 +89,4 @@ mod tests { let input = get_input(EXAMPLE); assert_eq!(part2(&input), 31); } -} \ No newline at end of file +} diff --git a/src/day4.rs b/src/day4.rs index f379b45..e8a68d1 100644 --- a/src/day4.rs +++ b/src/day4.rs @@ -53,11 +53,17 @@ impl WordSearch { for x in 0..width { for y in 0..height { // check down-right - if x <= width - needle.len() && y <= height - needle.len() && (0..needle.len()).all(|i| self.get(x + i, y + i) == needle.as_bytes()[i].into()) { + if x <= width - needle.len() + && y <= height - needle.len() + && (0..needle.len()).all(|i| self.get(x + i, y + i) == needle.as_bytes()[i].into()) + { count += 1 } // check down-left - if x >= needle.len() - 1 && y <= height - needle.len() && (0..needle.len()).all(|i| self.get(x - i, y + i) == needle.as_bytes()[i].into()) { + if x >= needle.len() - 1 + && y <= height - needle.len() + && (0..needle.len()).all(|i| self.get(x - i, y + i) == needle.as_bytes()[i].into()) + { count += 1 } } diff --git a/src/main.rs b/src/main.rs index d733dc6..e38be9e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,3 @@ use aoc_runner_derive::aoc_main; -aoc_main!{ lib = aoc2024 } \ No newline at end of file +aoc_main! { lib = aoc2024 }