2022 rust day 1 refactor

This commit is contained in:
Maciej Jur 2022-12-13 16:56:29 +01:00
parent 9c87607bf3
commit 00ec57dc3d

View file

@ -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
}) })