mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Display: replace boolean with integer count
This will probably be useful when i refactor for the reverse mode
This commit is contained in:
+2
-3
@@ -69,8 +69,8 @@ fn display_node(
|
|||||||
ntp_with_slash.matches('/').count() + 1
|
ntp_with_slash.matches('/').count() + 1
|
||||||
};
|
};
|
||||||
let mut num_siblings = count_siblings(to_display, num_slashes - 1, node_to_print);
|
let mut num_siblings = count_siblings(to_display, num_slashes - 1, node_to_print);
|
||||||
|
let max_siblings = num_siblings;
|
||||||
|
|
||||||
let mut is_biggest = true;
|
|
||||||
for &(ref k, _) in to_display.iter() {
|
for &(ref k, _) in to_display.iter() {
|
||||||
let temp = String::from(ensure_end_slash(node_to_print));
|
let temp = String::from(ensure_end_slash(node_to_print));
|
||||||
if k.starts_with(temp.as_str()) && k.matches('/').count() == num_slashes {
|
if k.starts_with(temp.as_str()) && k.matches('/').count() == num_slashes {
|
||||||
@@ -80,12 +80,11 @@ fn display_node(
|
|||||||
k,
|
k,
|
||||||
found,
|
found,
|
||||||
to_display,
|
to_display,
|
||||||
is_biggest,
|
num_siblings == max_siblings - 1,
|
||||||
short_paths,
|
short_paths,
|
||||||
new_depth,
|
new_depth,
|
||||||
&*(new_indent.to_string() + get_tree_chars(num_siblings != 0, has_children)),
|
&*(new_indent.to_string() + get_tree_chars(num_siblings != 0, has_children)),
|
||||||
);
|
);
|
||||||
is_biggest = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user