More Clippy
This commit is contained in:
parent
79cc4ef43c
commit
122e818060
@ -1,12 +1,12 @@
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
fn increases(measurements: &Vec<u64>) -> u64 {
|
||||
fn increases(measurements: &[u64]) -> u64 {
|
||||
measurements
|
||||
.windows(2)
|
||||
.fold(0, |acc, x| if x[1] > x[0] { acc + 1 } else { acc })
|
||||
}
|
||||
|
||||
fn convolve(measurements: &Vec<u64>) -> Vec<u64> {
|
||||
fn convolve(measurements: &[u64]) -> Vec<u64> {
|
||||
measurements.windows(3).map(|x| x.iter().sum()).collect()
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ impl<const N: usize> Diagnostics<N> {
|
||||
u32::from_str_radix(&self.least_common_value(), 2).unwrap()
|
||||
}
|
||||
|
||||
fn count_bit(&self, values: &Vec<String>, bit: usize) -> (usize, usize) {
|
||||
fn count_bit(&self, values: &[String], bit: usize) -> (usize, usize) {
|
||||
values
|
||||
.iter()
|
||||
.fold((0, 0), |acc, x| match x.chars().nth(bit).unwrap() {
|
||||
|
@ -11,14 +11,11 @@ struct Board {
|
||||
}
|
||||
|
||||
impl Board {
|
||||
fn mark<'a>(&'a mut self, number: u8) {
|
||||
fn mark(&mut self, number: u8) {
|
||||
for row in self.grid.iter_mut() {
|
||||
match row.iter_mut().find(|square| square.number == number) {
|
||||
Some(square) => {
|
||||
if let Some(square) = row.iter_mut().find(|square| square.number == number) {
|
||||
square.marked = true;
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user