diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-11-08 08:23:39 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-11-08 08:23:39 +0100 |
commit | 9b847e37543f4e610fe238ff90a23799287e84c8 (patch) | |
tree | ab302de653b3e663c8e66ee2f141d17509a46d1d /src/tree.rs | |
parent | 8e53337b880c6e3080b3066944567bee3365a6d4 (diff) |
rename a variable
Diffstat (limited to 'src/tree.rs')
-rw-r--r-- | src/tree.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tree.rs b/src/tree.rs index f495acb..e78592f 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -156,15 +156,15 @@ impl Tree { let root_depth = root_path.components().collect::<Vec<_>>().len(); let mut stack = vec![root_path.to_owned()]; let mut nodes: HashMap<PathBuf, Node> = HashMap::new(); - let mut last_path = root_path.to_owned(); + while let Some(current_path) = stack.pop() { let reached_depth = current_path.components().collect::<Vec<_>>().len(); if reached_depth >= depth + root_depth { continue; } let children_will_be_added = depth + root_depth - reached_depth > 1; - let mut node = Node::new(¤t_path, None); + let mut current_node = Node::new(¤t_path, None); if current_path.is_dir() && !current_path.is_symlink() && children_will_be_added { if let Some(mut files) = files_collection(¤t_path, users, show_hidden, filter_kind, true) @@ -172,12 +172,12 @@ impl Tree { sort_kind.sort(&mut files); let children = Self::make_children_and_stack_them(&mut stack, &files); if !children.is_empty() { - node.set_children(Some(children)); + current_node.set_children(Some(children)); } }; } - last_path = node.path.to_owned(); - nodes.insert(node.path.to_owned(), node); + last_path = current_path.to_owned(); + nodes.insert(current_path.to_owned(), current_node); } let Some(root_node) = nodes.get_mut(&root_path) else { |