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);
|
digits.push(d as i32);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(d) = NUMBERS
|
if let Some(d) = NUMBERS.iter().enumerate().find_map(|(n, nstr)| {
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.find_map(|(n, nstr)| {
|
|
||||||
if line[i..].starts_with(nstr) {
|
if line[i..].starts_with(nstr) {
|
||||||
Some(n as i32 + 1)
|
Some(n as i32 + 1)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
}) {
|
||||||
{
|
|
||||||
digits.push(d)
|
digits.push(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue