Clean Day 7 part 2
This commit is contained in:
parent
ff8d6098a3
commit
19bd0cdac1
|
@ -94,14 +94,14 @@ fn solution(input: impl Iterator<Item = &'static str>) -> u32 {
|
||||||
.take_while(|&c| c != b' ')
|
.take_while(|&c| c != b' ')
|
||||||
.fold(0u32, |a, x| a * 10 + (x - b'0') as u32);
|
.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
|
v.children
|
||||||
.entry(name.to_string())
|
.entry(name.to_string())
|
||||||
.or_insert(Node::File(fsize));
|
.or_insert(Node::File(fsize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
compute_dir_size(&mut tree);
|
compute_dir_size(&mut tree);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user