Skip to content

Commit

Permalink
further simplification of day 1
Browse files Browse the repository at this point in the history
  • Loading branch information
klaeufer committed Mar 22, 2024
1 parent 2873a1c commit 8e28b0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bin/day1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() -> io::Result<()> {

fn run_calibration(label: &str, file_name: &str, digits: &[String]) -> io::Result<()> {
let file = File::open("data/".to_string() + file_name)?;
let lines = BufReader::new(file).lines().collect::<io::Result<Vec<String>>>()?;
let lines = BufReader::new(file).lines().collect::<io::Result<Vec<_>>>()?;
println!("Day 1 {} solution: {}", label, calibrate_lines(&lines, digits));
Ok(())
}
Expand Down Expand Up @@ -91,7 +91,7 @@ fn test_part_1() {
"pqr3stu8vwx",
"a1b2c3d4e5f",
"treb7uchet",
].map(str::to_string).to_vec();
].map(str::to_string);
assert_eq!(calibrate_lines(&example, &SIMPLE_DIGITS), 142);
}

Expand All @@ -105,6 +105,6 @@ fn test_part_2() {
"4nineeightseven2",
"zoneight234",
"7pqrstsixteen",
].map(str::to_string).to_vec();
].map(str::to_string);
assert_eq!(calibrate_lines(&example, &ALL_DIGITS), 281);
}

0 comments on commit 8e28b0b

Please sign in to comment.