mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Bring back the reverse flag
Following the large refactor on the previous commit, this commit fixes the reverse functionality. Depth detection moved into the tree building instead of being calculated when drawing the tree to screen
This commit is contained in:
@@ -122,15 +122,6 @@ pub fn sort_by_size_first_name_second(a: &(String, u64), b: &(String, u64)) -> O
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compare_tuple_smallest_first(a: &(String, u64), b: &(String, u64)) -> Ordering {
|
||||
let result = a.1.cmp(&b.1);
|
||||
if result == Ordering::Equal {
|
||||
b.0.cmp(&a.0)
|
||||
} else {
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
pub fn sort(data: HashMap<String, u64>) -> Vec<(String, u64)> {
|
||||
let mut new_l: Vec<(String, u64)> = data.iter().map(|(a, b)| (a.clone(), *b)).collect();
|
||||
new_l.sort_by(|a, b| sort_by_size_first_name_second(&a, &b));
|
||||
|
||||
Reference in New Issue
Block a user