From 9de2e7d72395a7a215cb243c48f34501a6db76a5 Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Wed, 28 Jul 2021 16:23:18 +0100 Subject: [PATCH] bugfix: Fix crash when using '-f' flag The old code was subtly different in the way the root node worked. This changed in the v0.6.0 version when dependencies were removed. The code to handle file count was never updated https://github.com/bootandy/dust/issues/162 --- src/display.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display.rs b/src/display.rs index 57cc0e5..6ab2274 100644 --- a/src/display.rs +++ b/src/display.rs @@ -125,7 +125,7 @@ pub fn draw_it( let root_node = option_root_node.unwrap(); let num_chars_needed_on_left_most = if by_filecount { - let max_size = root_node.children.iter().map(|n| n.size).fold(0, max); + let max_size = root_node.size; max_size.separate_with_commas().chars().count() } else { 5 // Under normal usage we need 5 chars to display the size of a directory