Skip to content

Commit

Permalink
Implement cargo clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
tjheslin1 committed Dec 3, 2021
1 parent eb4c726 commit aea0769
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions 2021/day3/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn find_by_bit_criteria(readings: &[&str], most_common: bool, on_match: char) ->
if acc.len() > 1 {
acc.iter()
.filter(|line| line.chars().nth(index).unwrap() == bit_to_match)
.map(|x| *x)
.copied()
.collect::<Vec<&str>>()
} else {
acc
Expand Down Expand Up @@ -82,12 +82,10 @@ fn find_common_bit(most_common: bool, column: &str, on_match: char) -> char {
} else {
'1'
}
} else if most_common {
'1'
} else {
if most_common {
'1'
} else {
'0'
}
'0'
}
}

Expand Down

0 comments on commit aea0769

Please sign in to comment.