Ran Clippy

This commit is contained in:
Zoé Cassiopée Gauthier 2021-12-06 14:17:43 -05:00
parent 9aa5eb3727
commit 846d00baa4
6 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ fn convolve(measurements: &Vec<u64>) -> Vec<u64> {
}
fn main() {
const INPUT: &'static str = include_str!("../inputs/day1.txt");
const INPUT: &str = include_str!("../inputs/day1.txt");
let measurements: Vec<u64> = io::Cursor::new(INPUT)
.lines()
.map(|line| line.unwrap().parse().unwrap())

View File

@ -27,13 +27,13 @@ impl FromStr for Command {
let units = words.1.parse()?;
Ok(Command {
action: action.unwrap(),
units: units,
units,
})
}
}
fn main() {
const INPUT: &'static str = include_str!("../inputs/day2.txt");
const INPUT: &str = include_str!("../inputs/day2.txt");
let commands: Vec<Command> = io::Cursor::new(INPUT)
.lines()
.map(|l| l.unwrap().parse().unwrap())

View File

@ -87,9 +87,9 @@ impl<const N: usize> Diagnostics<N> {
}
fn main() {
const INPUT: &'static str = include_str!("../inputs/day3.txt");
const INPUT: &str = include_str!("../inputs/day3.txt");
let report: Vec<String> = io::Cursor::new(INPUT).lines().map(|l| l.unwrap()).collect();
let diagnostics = Diagnostics::<12> { report: report };
let diagnostics = Diagnostics::<12> { report };
println!(
"gamma rate {} epsilon rate {}",
@ -128,6 +128,6 @@ fn oxygen_generator_rating() {
"00010".to_string(),
"01010".to_string(),
];
let diagnostics = Diagnostics::<5> { report: report };
let diagnostics = Diagnostics::<5> { report };
assert_eq!(diagnostics.most_common_value(), "10111");
}

View File

@ -61,12 +61,12 @@ impl FromStr for Board {
.collect()
})
.collect::<Vec<Vec<Square>>>();
Ok(Board { grid: grid })
Ok(Board { grid })
}
}
fn main() {
const INPUT: &'static str = include_str!("../inputs/day4.txt");
const INPUT: &str = include_str!("../inputs/day4.txt");
solve_part1(INPUT);
solve_part2(INPUT);
}

View File

@ -72,7 +72,7 @@ impl fmt::Display for Vent {
}
fn main() {
const INPUT: &'static str = include_str!("../inputs/day5.txt");
const INPUT: &str = include_str!("../inputs/day5.txt");
let vents: Vec<Vent> = INPUT.lines().map(|line| line.parse().unwrap()).collect();
let mut map = HashMap::<(u32, u32), u32>::new();
for vent in vents {

View File

@ -1,5 +1,5 @@
fn main() {
const INPUT: &'static str = include_str!("../inputs/day6.txt");
const INPUT: &str = include_str!("../inputs/day6.txt");
let fishes: Vec<usize> = INPUT
.strip_suffix('\n')
.unwrap()
@ -7,7 +7,7 @@ fn main() {
.map(|timer| timer.parse::<usize>().unwrap())
.collect();
println!("solution {}", solve(fishes.clone(), 80));
println!("solution {}", solve(fishes.clone(), 256));
println!("solution {}", solve(fishes, 256));
}
const BIRTH_RATE: usize = 7;