mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
100% fewer suppresed clippy warnings
This commit is contained in:
@@ -297,27 +297,23 @@ pub fn part2(input: &[u8]) -> Result<String> {
|
|||||||
Step::Forward(mut amount) => {
|
Step::Forward(mut amount) => {
|
||||||
'outer: while amount > 0 {
|
'outer: while amount > 0 {
|
||||||
let map = &squares[current_square].0;
|
let map = &squares[current_square].0;
|
||||||
|
|
||||||
// Need to allow unused range bound, since we're actually tracking how much we
|
|
||||||
// still have to do. The loops are expected to end early, and we should remember
|
|
||||||
// how much work we've actually done.
|
|
||||||
#[allow(clippy::mut_range_bound)]
|
|
||||||
let coord = match dir {
|
let coord = match dir {
|
||||||
Direction::Up => {
|
Direction::Up => {
|
||||||
for _ in 0..amount {
|
while amount > 0 {
|
||||||
if y == 0 {
|
if y == 0 {
|
||||||
break;
|
break;
|
||||||
} else if map[y - 1][x] == b'#' {
|
} else if map[y - 1][x] == b'#' {
|
||||||
break 'outer;
|
break 'outer;
|
||||||
} else {
|
} else {
|
||||||
y -= 1;
|
y -= 1;
|
||||||
|
amount -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
Direction::Down => {
|
Direction::Down => {
|
||||||
for _ in 0..amount {
|
while amount > 0 {
|
||||||
if y + 1 >= side_length {
|
if y + 1 >= side_length {
|
||||||
break;
|
break;
|
||||||
} else if map[y + 1][x] == b'#' {
|
} else if map[y + 1][x] == b'#' {
|
||||||
@@ -331,7 +327,7 @@ pub fn part2(input: &[u8]) -> Result<String> {
|
|||||||
x
|
x
|
||||||
}
|
}
|
||||||
Direction::Left => {
|
Direction::Left => {
|
||||||
for _ in 0..amount {
|
while amount > 0 {
|
||||||
if x == 0 {
|
if x == 0 {
|
||||||
break;
|
break;
|
||||||
} else if map[y][x - 1] == b'#' {
|
} else if map[y][x - 1] == b'#' {
|
||||||
@@ -345,7 +341,7 @@ pub fn part2(input: &[u8]) -> Result<String> {
|
|||||||
y
|
y
|
||||||
}
|
}
|
||||||
Direction::Right => {
|
Direction::Right => {
|
||||||
for _ in 0..amount {
|
while amount > 0 {
|
||||||
if x + 1 >= side_length {
|
if x + 1 >= side_length {
|
||||||
break;
|
break;
|
||||||
} else if map[y][x + 1] == b'#' {
|
} else if map[y][x + 1] == b'#' {
|
||||||
|
|||||||
Reference in New Issue
Block a user