1
0

Clean Day 7 part 2

This commit is contained in:
Ishan Jain 2022-12-07 21:10:50 +05:30
parent ff8d6098a3
commit 19bd0cdac1
Signed by: ishan
GPG Key ID: 0506DB2A1CC75C27

View File

@ -94,14 +94,14 @@ 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 {
let Node::Directory(v) = current else {unreachable!("not a directory") };
v.children
.entry(name.to_string())
.or_insert(Node::File(fsize));
}
}
}
}
compute_dir_size(&mut tree);