clippy: fix lints
This commit is contained in:
parent
e01307eb3c
commit
e82df94852
7 changed files with 16 additions and 16 deletions
|
|
@ -154,16 +154,16 @@ impl CompletePassport {
|
|||
|
||||
fn hgt_valid(&self) -> bool {
|
||||
if let Some(num) = self.hgt.strip_suffix("in") {
|
||||
is_number_in_range(&num, 59..=76)
|
||||
is_number_in_range(num, 59..=76)
|
||||
} else if let Some(num) = self.hgt.strip_suffix("cm") {
|
||||
is_number_in_range(&num, 150..=193)
|
||||
is_number_in_range(num, 150..=193)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn hcl_valid(&self) -> bool {
|
||||
if let Some(rest) = self.hcl.strip_prefix("#") {
|
||||
if let Some(rest) = self.hcl.strip_prefix('#') {
|
||||
rest.chars().filter(|c| !c.is_ascii_hexdigit()).count() == 0
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ impl Layout {
|
|||
|
||||
match cell {
|
||||
Cell::EmptySeat => {
|
||||
if adj_count(&self, i, j, Cell::OccupiedSeat) == 0 {
|
||||
if adj_count(self, i, j, Cell::OccupiedSeat) == 0 {
|
||||
new[i][j] = Cell::OccupiedSeat;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
Cell::OccupiedSeat => {
|
||||
if adj_count(&self, i, j, Cell::OccupiedSeat) >= occupied_threshold {
|
||||
if adj_count(self, i, j, Cell::OccupiedSeat) >= occupied_threshold {
|
||||
new[i][j] = Cell::EmptySeat;
|
||||
changed = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ fn part2(input: &str) -> Result<usize> {
|
|||
|
||||
let count = neighbours
|
||||
.iter()
|
||||
.filter(|tile| black_tiles.contains(&tile))
|
||||
.filter(|tile| black_tiles.contains(tile))
|
||||
.count();
|
||||
if black_tiles.contains(&tile) {
|
||||
// Any black tile with zero or more than 2 black tiles immediately adjacent to it is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue