Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lpenz committed Dec 23, 2023
1 parent 214f56b commit dd606e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 3 additions & 1 deletion day03/src/bin/day03a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ fn process(bufin: impl BufRead) -> Result<u32> {
}
// Check adjacencies, with diagonals:
for dir in Dir::iter::<true>() {
let Ok(qa_adj) = qa_symbol + dir else { continue };
let Ok(qa_adj) = qa_symbol + dir else {
continue;
};
let Ok(number) = grid_get_number(&mut grid, qa_adj) else {
continue;
};
Expand Down
4 changes: 3 additions & 1 deletion day03/src/bin/day03b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ fn process(bufin: impl BufRead) -> Result<u32> {
// Check adjacencies, with diagonals:
let mut this_gear = vec![];
for dir in Dir::iter::<true>() {
let Ok(qa_adj) = qa_symbol + dir else { continue };
let Ok(qa_adj) = qa_symbol + dir else {
continue;
};
let Ok(number) = grid_get_number(&mut grid, qa_adj) else {
continue;
};
Expand Down
8 changes: 2 additions & 6 deletions day11/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,8 @@ pub fn calc_distances(inc: i64, input: Vec<Vec<Cell>>) -> Result<i64> {
for x in 0..=xmax {
if !xs.contains(&x) {
xinc += inc;
} else {
if galaxies.contains(&(x, y)) {
let x = x as i64;
let y = y as i64;
galaxies2.push((x + xinc, y + yinc));
}
} else if galaxies.contains(&(x, y)) {
galaxies2.push((x + xinc, y + yinc));
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions day17/src/bin/day17b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ fn process(size: u16, bufin: impl BufRead) -> Result<u32> {
let input = parser::parse(bufin)?;
let gheat = Grid::try_from(input)?;
solve(size, gheat, |st, dir| {
true
// Can't go back:
&& st.lastdir != Some(-dir)
// Can't go back:
st.lastdir != Some(-dir)
// Must go at least 4 spaces:
&& (st.lastdir.is_none() || st.lastdir == Some(dir) || st.dircount >= 4)
// And not more than 10:
Expand Down

0 comments on commit dd606e9

Please sign in to comment.