mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
replace nested if w/ match in get_tree_chars
This commit is contained in:
+9
-25
@@ -32,32 +32,16 @@ pub struct DisplayData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayData {
|
impl DisplayData {
|
||||||
#[allow(clippy::collapsible_if)]
|
|
||||||
fn get_tree_chars(&self, was_i_last: bool, has_children: bool) -> &'static str {
|
fn get_tree_chars(&self, was_i_last: bool, has_children: bool) -> &'static str {
|
||||||
if self.is_reversed {
|
match (self.is_reversed, was_i_last, has_children) {
|
||||||
if was_i_last {
|
(true, true, true) => "┌─┴",
|
||||||
if has_children {
|
(true, true, false) => "┌──",
|
||||||
"┌─┴"
|
(true, false, true) => "├─┴",
|
||||||
} else {
|
(true, _, _) => "├──",
|
||||||
"┌──"
|
(false, true, true) => "└─┬",
|
||||||
}
|
(false, true, false) => "└──",
|
||||||
} else if has_children {
|
(false, false, true) => "├─┬",
|
||||||
"├─┴"
|
(false, false, false) => "├──",
|
||||||
} else {
|
|
||||||
"├──"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if was_i_last {
|
|
||||||
if has_children {
|
|
||||||
"└─┬"
|
|
||||||
} else {
|
|
||||||
"└──"
|
|
||||||
}
|
|
||||||
} else if has_children {
|
|
||||||
"├─┬"
|
|
||||||
} else {
|
|
||||||
"├──"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user