1
0
Fork 0

Clippy suggestions

This commit is contained in:
Vivianne 2022-12-02 22:24:42 -08:00
parent 92306ca539
commit 0db7712260
1 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ fn main() {
let reader = io::BufReader::new(file); let reader = io::BufReader::new(file);
println!("PART ONE ---------------"); println!("PART ONE ---------------");
let lines = reader.lines().try_collect().expect("Expected all lines to be valid"); let lines: Vec<String> = reader.lines().try_collect().expect("Expected all lines to be valid");
part1(&lines); part1(&lines);
println!("\n PART TWO ---------------"); println!("\n PART TWO ---------------");
@ -28,11 +28,11 @@ fn to_priority(c: char) -> Result<u32, &'static str> {
} }
} }
fn part1(lines: &Vec<String>) { fn part1(lines: &[String]) {
let mut sum: u32 = 0; let mut sum: u32 = 0;
for line in lines { for line in lines {
let (left, right) = line.split_at(line.len() / 2); let (left, right) = line.split_at(line.len() / 2);
let left_set = HashSet::<char>::from_iter(left.chars()); let left_set: HashSet<char> = left.chars().collect();
let mut right_set = HashSet::<char>::new(); let mut right_set = HashSet::<char>::new();
let outlier = right.chars().find(|c| { let outlier = right.chars().find(|c| {
right_set.insert(*c); right_set.insert(*c);
@ -47,7 +47,7 @@ fn part1(lines: &Vec<String>) {
println!("Sum: {}", sum); println!("Sum: {}", sum);
} }
fn part2(_lines: &Vec<String>) { fn part2(_lines: &[String]) {
} }
#[cfg(test)] #[cfg(test)]