diff --git a/src/display.rs b/src/display.rs index a6a1b37..e1736ae 100644 --- a/src/display.rs +++ b/src/display.rs @@ -12,7 +12,7 @@ use chrono::{DateTime, Local, TimeZone, Utc}; use std::cmp::max; use std::cmp::min; use std::fs; -use std::iter::repeat; +use std::iter::repeat_n; use std::path::Path; use thousands::Separable; @@ -155,7 +155,7 @@ pub fn draw_it( allowed_width - longest_string_length - 7 }; - let first_size_bar = repeat(BLOCKS[0]).take(max_bar_length).collect(); + let first_size_bar = repeat_n(BLOCKS[0], max_bar_length).collect(); let display_data = DisplayData { initial: idd, @@ -298,12 +298,9 @@ fn pad_or_trim_filename(node: &DisplayNode, indent: &str, display_data: &Display ); // Add spaces after the filename so we can draw the % used bar chart. - let name_and_padding = name - + " " - .repeat(display_data.longest_string_length - width) - .as_str(); - - name_and_padding + name + " " + .repeat(display_data.longest_string_length - width) + .as_str() } fn maybe_trim_filename(name_in: String, indent: &str, display_data: &DisplayData) -> String { @@ -594,7 +591,7 @@ mod tests { size: 2_u64.pow(size), children: vec![], }; - let first_size_bar = repeat(BLOCKS[0]).take(13).collect(); + let first_size_bar = repeat_n(BLOCKS[0], 13).collect(); let dd = DrawData { indent: "".into(), percent_bar: first_size_bar,