diff --git a/rust/src/day04/part_1.rs b/rust/src/day04/part_1.rs index e9f5ddd..d9b0915 100644 --- a/rust/src/day04/part_1.rs +++ b/rust/src/day04/part_1.rs @@ -12,8 +12,7 @@ pub(crate) fn part_1(input: &[[[u32; 2]; 2]]) -> usize { let times_contained = input .iter() .filter(|sections| sections_contain_each_other(**sections)) - .collect::>() - .len(); + .count(); println!("Part 1: {times_contained}"); times_contained } diff --git a/rust/src/day04/part_2.rs b/rust/src/day04/part_2.rs index 8fa20da..b40e8b0 100644 --- a/rust/src/day04/part_2.rs +++ b/rust/src/day04/part_2.rs @@ -12,8 +12,7 @@ pub(crate) fn part_2(input: &[[[u32; 2]; 2]]) -> usize { let times_overlapped = input .iter() .filter(|sections| sections_overlap(**sections)) - .collect::>() - .len(); + .count(); println!("Part 2: {times_overlapped}"); times_overlapped } diff --git a/rust/src/day09/part_1.rs b/rust/src/day09/part_1.rs index f749a63..2689923 100644 --- a/rust/src/day09/part_1.rs +++ b/rust/src/day09/part_1.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use crate::Move; -pub(crate) fn part_1(input: &Vec) -> usize { +pub(crate) fn part_1(input: &[Move]) -> usize { let mut head_position = (0i64, 0i64); let mut tail_position = (0i64, 0i64); let mut visited_tail_positions = HashSet::new(); diff --git a/rust/src/day09/part_2.rs b/rust/src/day09/part_2.rs index e5eaecf..5afab14 100644 --- a/rust/src/day09/part_2.rs +++ b/rust/src/day09/part_2.rs @@ -52,7 +52,7 @@ fn tail_update(diff: (i64, i64)) -> (i64, i64) { } } -pub(crate) fn part_2(input: &Vec) -> usize { +pub(crate) fn part_2(input: &[Move]) -> usize { let mut rope = Rope::::new(); for head_movement in input {