Change cd .. to use parent method

This commit is contained in:
pjht 2022-12-07 13:19:50 -06:00
parent 6f9ee71a9b
commit 453590c541

View File

@ -113,12 +113,7 @@ fn compute_dir_sizes(input: &[CliOperation]) -> Tree<(usize, usize)> {
match op {
CliOperation::Cd(dir) => {
if dir == ".." {
current_node = tree
.ancestor_ids(&current_node)
.unwrap()
.next()
.unwrap()
.clone();
current_node = tree.get(&current_node).unwrap().parent().unwrap().clone();
} else {
current_node = tree
.insert(Node::new((0, 0)), InsertBehavior::UnderNode(&current_node))