chore: rust fmt
This commit is contained in:
parent
e8a38e7b24
commit
74a6b16924
@ -89,4 +89,4 @@ mod tests {
|
|||||||
let input = get_input(EXAMPLE);
|
let input = get_input(EXAMPLE);
|
||||||
assert_eq!(part2(&input), 31);
|
assert_eq!(part2(&input), 31);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/day4.rs
10
src/day4.rs
@ -53,11 +53,17 @@ impl WordSearch {
|
|||||||
for x in 0..width {
|
for x in 0..width {
|
||||||
for y in 0..height {
|
for y in 0..height {
|
||||||
// check down-right
|
// 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
|
count += 1
|
||||||
}
|
}
|
||||||
// check down-left
|
// 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
|
count += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
use aoc_runner_derive::aoc_main;
|
use aoc_runner_derive::aoc_main;
|
||||||
|
|
||||||
aoc_main!{ lib = aoc2024 }
|
aoc_main! { lib = aoc2024 }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user