mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Code cleanup from previous commit
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ impl DisplayData {
|
|||||||
(true, true, true) => "┌─┴",
|
(true, true, true) => "┌─┴",
|
||||||
(true, true, false) => "┌──",
|
(true, true, false) => "┌──",
|
||||||
(true, false, true) => "├─┴",
|
(true, false, true) => "├─┴",
|
||||||
(true, _, _) => "├──",
|
(true, false, false) => "├──",
|
||||||
(false, true, true) => "└─┬",
|
(false, true, true) => "└─┬",
|
||||||
(false, true, false) => "└──",
|
(false, true, false) => "└──",
|
||||||
(false, false, true) => "├─┬",
|
(false, false, true) => "├─┬",
|
||||||
|
|||||||
+5
-7
@@ -52,13 +52,12 @@ impl Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_children_from_node(&self, is_reversed: bool) -> impl Iterator<Item = Node> {
|
pub fn get_children_from_node(&self, is_reversed: bool) -> impl Iterator<Item = Node> {
|
||||||
let children = self.children.clone();
|
|
||||||
if is_reversed {
|
if is_reversed {
|
||||||
let children: Vec<Node> = children.into_iter().rev().collect();
|
let children: Vec<Node> = self.children.clone().into_iter().rev().collect();
|
||||||
return children.into_iter();
|
|
||||||
}
|
|
||||||
|
|
||||||
children.into_iter()
|
children.into_iter()
|
||||||
|
} else {
|
||||||
|
self.children.clone().into_iter()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,9 +146,8 @@ pub fn get_dir_tree<P: AsRef<Path>>(
|
|||||||
let path = p.path();
|
let path = p.path();
|
||||||
let parts = path.components().collect::<Vec<std::path::Component>>();
|
let parts = path.components().collect::<Vec<std::path::Component>>();
|
||||||
for d in dirs {
|
for d in dirs {
|
||||||
let seq = d.components().collect::<Vec<std::path::Component>>();
|
|
||||||
if parts
|
if parts
|
||||||
.windows(seq.len())
|
.windows(d.components().count())
|
||||||
.any(|window| window.iter().collect::<PathBuf>() == *d)
|
.any(|window| window.iter().collect::<PathBuf>() == *d)
|
||||||
{
|
{
|
||||||
return WalkState::Continue;
|
return WalkState::Continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user