Clean Day 7 part 2
This commit is contained in:
parent
ff8d6098a3
commit
19bd0cdac1
10
src/main.rs
10
src/main.rs
|
@ -94,11 +94,11 @@ fn solution(input: impl Iterator<Item = &'static str>) -> u32 {
|
|||
.take_while(|&c| c != b' ')
|
||||
.fold(0u32, |a, x| a * 10 + (x - b'0') as u32);
|
||||
|
||||
if let Node::Directory(v) = current {
|
||||
v.children
|
||||
.entry(name.to_string())
|
||||
.or_insert(Node::File(fsize));
|
||||
}
|
||||
let Node::Directory(v) = current else {unreachable!("not a directory") };
|
||||
|
||||
v.children
|
||||
.entry(name.to_string())
|
||||
.or_insert(Node::File(fsize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user