day(01): format
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
b0554f5cf4
commit
673c9299d5
1 changed files with 7 additions and 11 deletions
|
@ -39,17 +39,13 @@ impl Solution<Output1, Output2> for Day01 {
|
|||
digits.push(d as i32);
|
||||
}
|
||||
|
||||
if let Some(d) = NUMBERS
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find_map(|(n, nstr)| {
|
||||
if line[i..].starts_with(nstr) {
|
||||
Some(n as i32 + 1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
{
|
||||
if let Some(d) = NUMBERS.iter().enumerate().find_map(|(n, nstr)| {
|
||||
if line[i..].starts_with(nstr) {
|
||||
Some(n as i32 + 1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}) {
|
||||
digits.push(d)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue