From 453590c541b5a19c442167b21d2ffc68291a1b56 Mon Sep 17 00:00:00 2001 From: pjht Date: Wed, 7 Dec 2022 13:19:50 -0600 Subject: [PATCH] Change cd .. to use parent method --- src/day07.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/day07.rs b/src/day07.rs index ef71129..976c4a0 100644 --- a/src/day07.rs +++ b/src/day07.rs @@ -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(¤t_node) - .unwrap() - .next() - .unwrap() - .clone(); + current_node = tree.get(¤t_node).unwrap().parent().unwrap().clone(); } else { current_node = tree .insert(Node::new((0, 0)), InsertBehavior::UnderNode(¤t_node))