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()
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue