2022 rust day 1 refactor
This commit is contained in:
parent
9c87607bf3
commit
00ec57dc3d
|
@ -47,9 +47,8 @@ fn parse_data<T: AsRef<str>>(data: &[T]) -> Vec<Vec<i32>> {
|
||||||
let s = next.as_ref();
|
let s = next.as_ref();
|
||||||
match s.len() == 0 {
|
match s.len() == 0 {
|
||||||
true => acc.push(Vec::new()),
|
true => acc.push(Vec::new()),
|
||||||
false => {
|
false => acc.last_mut()
|
||||||
acc.last_mut().and_then(|last| Some(last.push(s.parse().unwrap())));
|
.and_then(|last| Some(last.push(s.parse().unwrap())))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
acc
|
acc
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue