diff --git a/2022/src/days/day3.rs b/2022/src/days/day3.rs index c8f417f..f8f26ff 100644 --- a/2022/src/days/day3.rs +++ b/2022/src/days/day3.rs @@ -1,6 +1,6 @@ use anyhow::Result; -use std::fs; use std::collections::HashSet; +use std::fs; fn get_priority(t: &char) -> u32 { if t.is_ascii_uppercase() { @@ -47,14 +47,20 @@ pub fn run() -> Result<()> { let elf2map: HashSet = HashSet::from_iter(elf2.chars()); let elf3map: HashSet = HashSet::from_iter(elf3.chars()); - for dupe in elf1map.iter().filter(|t| elf2map.contains(t) && elf3map.contains(t)) { + for dupe in elf1map + .iter() + .filter(|t| elf2map.contains(t) && elf3map.contains(t)) + { rucksacks2.push(get_priority(dupe)); } } else { break; } } - println!("part two priorities {}", rucksacks2.into_iter().sum::()); + println!( + "part two priorities {}", + rucksacks2.into_iter().sum::() + ); Ok(()) }