1
0
Fork 0

day(01): format

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-12-03 13:13:23 +01:00
parent b0554f5cf4
commit 673c9299d5
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -39,17 +39,13 @@ impl Solution<Output1, Output2> for Day01 {
digits.push(d as i32); digits.push(d as i32);
} }
if let Some(d) = NUMBERS if let Some(d) = NUMBERS.iter().enumerate().find_map(|(n, nstr)| {
.iter() if line[i..].starts_with(nstr) {
.enumerate() Some(n as i32 + 1)
.find_map(|(n, nstr)| { } else {
if line[i..].starts_with(nstr) { None
Some(n as i32 + 1) }
} else { }) {
None
}
})
{
digits.push(d) digits.push(d)
} }
} }