Skip to content

Commit c1b4dcb

Browse files
committed
fix: format code with cargo fmt
1 parent beb014c commit c1b4dcb

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

src/main.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn main() -> Result<()> {
6565
Some((extension, size))
6666
})
6767
.fold(
68-
|| HashMap::new(),
68+
HashMap::new,
6969
|mut acc, (ext, size)| {
7070
let entry = acc.entry(ext).or_insert((0, 0));
7171
entry.0 += size;
@@ -74,7 +74,7 @@ fn main() -> Result<()> {
7474
},
7575
)
7676
.reduce(
77-
|| HashMap::new(),
77+
HashMap::new,
7878
|mut acc, map| {
7979
for (ext, (size, count)) in map {
8080
let entry = acc.entry(ext).or_insert((0, 0));
@@ -114,12 +114,7 @@ fn get_extension(path: &Path) -> String {
114114
.unwrap_or_else(|| "[no extension]".to_string())
115115
}
116116

117-
fn display_results(
118-
stats: &[ExtensionStats],
119-
total_size: u64,
120-
total_files: usize,
121-
args: &Args,
122-
) {
117+
fn display_results(stats: &[ExtensionStats], total_size: u64, total_files: usize, args: &Args) {
123118
let mut table = Table::new();
124119
table
125120
.load_preset(UTF8_FULL)
@@ -172,18 +167,11 @@ fn display_results(
172167

173168
// Summary
174169
println!("\n📈 Summary:");
175-
println!(
176-
" Total size: {}",
177-
format_size(total_size, BINARY)
178-
);
170+
println!(" Total size: {}", format_size(total_size, BINARY));
179171
println!(" Total files: {}", total_files);
180172
println!(" Extensions found: {}", stats.len());
181173
if stats.len() > display_count {
182-
println!(
183-
" (Showing top {} out of {})",
184-
display_count,
185-
stats.len()
186-
);
174+
println!(" (Showing top {} out of {})", display_count, stats.len());
187175
}
188176
}
189177

@@ -192,9 +180,5 @@ fn create_bar(percentage: f64) -> String {
192180
let filled = ((percentage / 100.0) * bar_width as f64) as usize;
193181
let empty = bar_width - filled;
194182

195-
format!(
196-
"{}{}",
197-
"█".repeat(filled),
198-
"░".repeat(empty)
199-
)
183+
format!("{}{}", "█".repeat(filled), "░".repeat(empty))
200184
}

0 commit comments

Comments
 (0)