chore: rust fmt
This commit is contained in:
parent
e8a38e7b24
commit
74a6b16924
10
src/day4.rs
10
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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user