chore: use into for answers

This commit is contained in:
uku 2024-12-08 14:46:37 +01:00
parent a67033d39b
commit 6a54618880
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
7 changed files with 33 additions and 48 deletions

View file

@ -10,20 +10,19 @@ impl Solution for Day02 {
}
fn part_a(&self, input: &str) -> Answer {
let reports = input
input
.lines()
.filter(|l| {
let nums = l.split_whitespace().map(|n| n.parse::<i32>().unwrap());
is_valid(&nums)
})
.count();
Answer::Number(reports as u64)
.count()
.into()
}
fn part_b(&self, input: &str) -> Answer {
let reports = input
input
.lines()
.filter(|l| {
let nums = l.split_whitespace().map(|n| n.parse::<i32>().unwrap());
@ -45,9 +44,8 @@ impl Solution for Day02 {
valid
})
.count();
Answer::Number(reports as u64)
.count()
.into()
}
}