From 494d5e7a91a335fd8f276513419d4df1e2530c03 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 6 Dec 2021 09:17:02 -0700 Subject: [PATCH] cleanup some clippy warnings --- src/day02.rs | 4 ++-- src/day03.rs | 11 +++++------ src/day04.rs | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/day02.rs b/src/day02.rs index 40813cb..72a39dc 100644 --- a/src/day02.rs +++ b/src/day02.rs @@ -35,8 +35,8 @@ fn follow_course_better(s: &str) -> i32 { pub(crate) fn run() -> Result<(usize, usize)> { let input = include_str!("../data/day02.txt"); Ok(( - follow_course(&input) as usize, - follow_course_better(&input) as usize, + follow_course(input) as usize, + follow_course_better(input) as usize, )) } diff --git a/src/day03.rs b/src/day03.rs index d29e846..27964e0 100644 --- a/src/day03.rs +++ b/src/day03.rs @@ -89,7 +89,7 @@ fn diagnose_lifesupport(s: &str) -> usize { pub(crate) fn run() -> Result<(usize, usize)> { let input = include_str!("../data/day03.txt"); - Ok((diagnose_power(&input), diagnose_lifesupport(&input))) + Ok((diagnose_power(input), diagnose_lifesupport(input))) } #[cfg(test)] @@ -99,15 +99,14 @@ mod tests { #[test] fn test_example() { let input = include_str!("../data/day03-test.txt"); - assert_eq!(diagnose_power(&input), 198); - assert_eq!(diagnose_lifesupport(&input), 230); + assert_eq!(diagnose_power(input), 198); + assert_eq!(diagnose_lifesupport(input), 230); } #[test] fn test_my_data() { let input = include_str!("../data/day03.txt"); - assert_eq!(diagnose_power(&input), 4191876); - // assert_eq!(follow_course(&input), 2070300); - // assert_eq!(follow_course_better(&input), 2078985210); + assert_eq!(diagnose_power(input), 4191876); + assert_eq!(diagnose_lifesupport(input), 3414905); } } diff --git a/src/day04.rs b/src/day04.rs index 1e4a695..b60d4be 100644 --- a/src/day04.rs +++ b/src/day04.rs @@ -82,14 +82,14 @@ mod tests { #[test] fn test_example() { let input = include_str!("../data/day04-test.txt"); - assert_eq!(find_winning_score(&input, true), 4512); - assert_eq!(find_winning_score(&input, false), 1924); + assert_eq!(find_winning_score(input, true), 4512); + assert_eq!(find_winning_score(input, false), 1924); } #[test] fn test_my_data() { let input = include_str!("../data/day04.txt"); - assert_eq!(find_winning_score(&input, true), 71708); - assert_eq!(find_winning_score(&input, false), 34726); + assert_eq!(find_winning_score(input, true), 71708); + assert_eq!(find_winning_score(input, false), 34726); } }