From 375e2fb1c3892dc47ee6a5d268a90330bd4984a3 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 4 Dec 2022 16:13:07 -0500 Subject: [PATCH] remove editor warning for import --- 2022/src/day_3.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2022/src/day_3.rs b/2022/src/day_3.rs index 80e31b7..8ea5d7c 100644 --- a/2022/src/day_3.rs +++ b/2022/src/day_3.rs @@ -1,5 +1,3 @@ -use std::collections::HashSet; - fn get_priority(c: char) -> i32 { match c { 'a'..='z' => c as i32 - 'a' as i32 + 1, @@ -16,6 +14,7 @@ advent_of_code_macro::solve_problem!( }, part one |data: Input| { data.iter().map(|s| { + use std::collections::HashSet; let (left, right) = s.split_at(s.len() / 2); let right_set: HashSet = right.chars().collect(); get_priority(left.chars().find(|c| right_set.contains(c)).unwrap()) @@ -23,6 +22,7 @@ advent_of_code_macro::solve_problem!( }, part two |data: Input| { data.as_slice().chunks(3).map(|c| { + use std::collections::HashSet; let second_set: HashSet = c[1].chars().collect(); let third_set: HashSet = c[2].chars().collect(); get_priority(c[0].chars().find(|c| second_set.contains(c) && third_set.contains(c)).unwrap())