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)]