From 846d00baa4bd33a32ef096510e742fae42ef5565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=A9=20Cassiop=C3=A9e=20Gauthier?= Date: Mon, 6 Dec 2021 14:17:43 -0500 Subject: [PATCH] Ran Clippy --- src/day1.rs | 2 +- src/day2.rs | 4 ++-- src/day3.rs | 6 +++--- src/day4.rs | 4 ++-- src/day5.rs | 2 +- src/day6.rs | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/day1.rs b/src/day1.rs index bc13f7a..6510021 100644 --- a/src/day1.rs +++ b/src/day1.rs @@ -11,7 +11,7 @@ fn convolve(measurements: &Vec) -> Vec { } fn main() { - const INPUT: &'static str = include_str!("../inputs/day1.txt"); + const INPUT: &str = include_str!("../inputs/day1.txt"); let measurements: Vec = io::Cursor::new(INPUT) .lines() .map(|line| line.unwrap().parse().unwrap()) diff --git a/src/day2.rs b/src/day2.rs index 4a05c45..5108e13 100644 --- a/src/day2.rs +++ b/src/day2.rs @@ -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 = io::Cursor::new(INPUT) .lines() .map(|l| l.unwrap().parse().unwrap()) diff --git a/src/day3.rs b/src/day3.rs index 83808d4..18c15d6 100644 --- a/src/day3.rs +++ b/src/day3.rs @@ -87,9 +87,9 @@ impl Diagnostics { } fn main() { - const INPUT: &'static str = include_str!("../inputs/day3.txt"); + const INPUT: &str = include_str!("../inputs/day3.txt"); let report: Vec = 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"); } diff --git a/src/day4.rs b/src/day4.rs index 78c1bd2..3159ded 100644 --- a/src/day4.rs +++ b/src/day4.rs @@ -61,12 +61,12 @@ impl FromStr for Board { .collect() }) .collect::>>(); - 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); } diff --git a/src/day5.rs b/src/day5.rs index 2726033..df94de4 100644 --- a/src/day5.rs +++ b/src/day5.rs @@ -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 = INPUT.lines().map(|line| line.parse().unwrap()).collect(); let mut map = HashMap::<(u32, u32), u32>::new(); for vent in vents { diff --git a/src/day6.rs b/src/day6.rs index 52cc86d..11de04e 100644 --- a/src/day6.rs +++ b/src/day6.rs @@ -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 = INPUT .strip_suffix('\n') .unwrap() @@ -7,7 +7,7 @@ fn main() { .map(|timer| timer.parse::().unwrap()) .collect(); println!("solution {}", solve(fishes.clone(), 80)); - println!("solution {}", solve(fishes.clone(), 256)); + println!("solution {}", solve(fishes, 256)); } const BIRTH_RATE: usize = 7;