Skip to content

Commit

Permalink
Clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
maneatingape committed Dec 27, 2024
1 parent d472f51 commit 0382fea
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/util/md5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn common(f: u32, a: u32, b: u32, m: u32, s: u32, k: u32) -> u32 {
#[cfg(feature = "simd")]
pub mod simd {
use std::array;
use std::simd::num::SimdUint;
use std::simd::num::SimdUint as _;
use std::simd::{LaneCount, Simd, SupportedLaneCount};

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/year2020/day06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! [`count_ones`]: u32::count_ones
pub fn parse(input: &str) -> Vec<u32> {
input.lines().map(|line| line.bytes().fold(0, |acc, b| acc | 1 << (b - b'a'))).collect()
input.lines().map(|line| line.bytes().fold(0, |acc, b| acc | (1 << (b - b'a')))).collect()
}

pub fn part1(input: &[u32]) -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion src/year2022/day03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn part2(input: &[&str]) -> u32 {
/// Build a set from a slice of ASCII characters, using the `fold` function to repeatedly OR
/// bit offsets into an accumulator.
fn mask(s: &str) -> u128 {
s.bytes().fold(0, |acc, b| acc | 1 << b)
s.bytes().fold(0, |acc, b| acc | (1 << b))
}

/// Find the lowest set bit (there should only be one) then convert to priority using the
Expand Down
8 changes: 4 additions & 4 deletions src/year2022/day24.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub fn parse(input: &str) -> Input {
let mut horizontal = Vec::with_capacity(width * height);
for time in 0..width {
for i in 0..height {
let left = left[i] << time | left[i] >> (width - time);
let right = right[i] >> time | right[i] << (width - time);
let left = (left[i] << time) | (left[i] >> (width - time));
let right = (right[i] >> time) | (right[i] << (width - time));
horizontal.push(left & right);
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ fn expedition(input: &Input, start: usize, forward: bool) -> usize {
next = state[i + 1];
// The Elves frontier can spread out 1 in each orthogonal direction unless there
// is a blizzard present.
state[i] = (cur | cur >> 1 | cur << 1 | prev | next)
state[i] = (cur | (cur >> 1) | (cur << 1) | prev | next)
& horizontal[height * (time % width) + i]
& vertical[height * (time % height) + i];
}
Expand All @@ -106,7 +106,7 @@ fn expedition(input: &Input, start: usize, forward: bool) -> usize {
// End position.
state[height - 1] |= 1;
// If we've reached the start then stop.
if state[0] & 1 << (width - 1) != 0 {
if state[0] & (1 << (width - 1)) != 0 {
break time + 1;
}
}
Expand Down

0 comments on commit 0382fea

Please sign in to comment.