Fix final clippy warnings

This commit is contained in:
2020-12-27 23:06:50 +01:00
parent e9870a1f18
commit e88ef7b410
3 changed files with 6 additions and 4 deletions

View File

@@ -93,6 +93,8 @@ where
T: Read,
{
reader: BufReader<T>,
// Clippy doesn't understand the use case of an Rc which is immediately released
#[allow(clippy::rc_buffer)]
buffer: Rc<String>,
}

View File

@@ -11,7 +11,7 @@ impl Solution for Day10 {
let mut adapters: Vec<u32> = from_lines(input);
// Outlet
adapters.push(0);
adapters.sort();
adapters.sort_unstable();
let device = *adapters.last().unwrap() + 3;
adapters.push(device);
@@ -27,7 +27,7 @@ impl Solution for Day10 {
fn part2(&mut self, input: &mut dyn Read) -> String {
let mut adapters: Vec<u32> = from_lines(input);
adapters.push(0);
adapters.sort();
adapters.sort_unstable();
let mut methods = vec![0u64; adapters.len()];
methods[0] = 1;

View File

@@ -16,12 +16,12 @@ impl FromStr for Entry {
type Err = Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
if s.starts_with("mask = ") {
if let Some(s) = s.strip_prefix("mask = ") {
let mut zero_mask = 0;
let mut one_mask = 0;
let mut x_mask = 0;
for c in s[7..].chars() {
for c in s.chars() {
zero_mask <<= 1;
one_mask <<= 1;
x_mask <<= 1;