chore: rust fmt

This commit is contained in:
Keenan Tims 2024-12-13 23:06:02 -08:00
parent e8a38e7b24
commit 74a6b16924
Signed by: ktims
GPG Key ID: 11230674D69038D4
3 changed files with 10 additions and 4 deletions

View File

@ -89,4 +89,4 @@ mod tests {
let input = get_input(EXAMPLE);
assert_eq!(part2(&input), 31);
}
}
}

View File

@ -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
}
}

View File

@ -1,3 +1,3 @@
use aoc_runner_derive::aoc_main;
aoc_main!{ lib = aoc2024 }
aoc_main! { lib = aoc2024 }