Skip to content

Commit

Permalink
minor reformat
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Läufer <[email protected]>
  • Loading branch information
klaeufer committed Mar 20, 2024
1 parent 25cd706 commit af50cdb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bin/day5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ fn process(label: &str, input: &mut impl Iterator<Item = String>) {
let seed_to_location = all_maps
.into_iter()
.rev()
.reduce(|f, g| Box::new(move |x| f(g(x)))).unwrap();
.reduce(|f, g| Box::new(move |x| f(g(x))))
.unwrap();

// part 1: find the minimum location for the given seeds
let part1 = seeds
.iter()
.map(|&x| seed_to_location(x))
.min().unwrap();
.min()
.unwrap();
println!("{} part 1: {}", label, part1);

// part 2: find the minimum location for the given seeds interpreted as ranges
Expand All @@ -96,6 +98,7 @@ fn process(label: &str, input: &mut impl Iterator<Item = String>) {
.min()
.unwrap()
})
.min().unwrap();
.min()
.unwrap();
println!("{} part 2: {}", label, part2);
}

0 comments on commit af50cdb

Please sign in to comment.