From a6d8472a214d119d2a8cdb17a779d4649d829e11 Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Mon, 2 Dec 2024 15:27:32 +0100 Subject: [PATCH] Day 02 remove unnecessary cast --- day02/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/day02/main.rs b/day02/main.rs index d71fef6..58e53d9 100644 --- a/day02/main.rs +++ b/day02/main.rs @@ -33,11 +33,11 @@ fn is_safe(report: &Vec) -> bool { }) } -fn part_1(input: &Vec>) -> i32 { - input.iter().filter(|&report| is_safe(report)).count() as i32 +fn part_1(input: &Vec>) -> usize { + input.iter().filter(|&report| is_safe(report)).count() } -fn part_2(input: &Vec>) -> i32 { +fn part_2(input: &Vec>) -> usize { input .iter() .filter(|report| { @@ -45,7 +45,7 @@ fn part_2(input: &Vec>) -> i32 { .map(|i| [&report[..i], &report[i + 1..]].concat()) .any(|modified_report| is_safe(&modified_report)) }) - .count() as i32 + .count() } #[cfg(test)]