Change cd .. to use parent method
This commit is contained in:
parent
6f9ee71a9b
commit
453590c541
@ -113,12 +113,7 @@ fn compute_dir_sizes(input: &[CliOperation]) -> Tree<(usize, usize)> {
|
|||||||
match op {
|
match op {
|
||||||
CliOperation::Cd(dir) => {
|
CliOperation::Cd(dir) => {
|
||||||
if dir == ".." {
|
if dir == ".." {
|
||||||
current_node = tree
|
current_node = tree.get(¤t_node).unwrap().parent().unwrap().clone();
|
||||||
.ancestor_ids(¤t_node)
|
|
||||||
.unwrap()
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.clone();
|
|
||||||
} else {
|
} else {
|
||||||
current_node = tree
|
current_node = tree
|
||||||
.insert(Node::new((0, 0)), InsertBehavior::UnderNode(¤t_node))
|
.insert(Node::new((0, 0)), InsertBehavior::UnderNode(¤t_node))
|
||||||
|
Loading…
Reference in New Issue
Block a user