Skip to content

Commit

Permalink
use more unstable sort
Browse files Browse the repository at this point in the history
  • Loading branch information
Esgrove committed May 18, 2024
1 parent 77a4919 commit 6908ad4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/renamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl Renamer {
if self.config.genre_statistics {
println!("Genres ({}):", genres.len());
let mut genre_list: Vec<(String, usize)> = genres.into_iter().collect();
genre_list.sort_by(|a, b| b.1.cmp(&a.1));
genre_list.sort_unstable_by(|a, b| b.1.cmp(&a.1));
let max_lenght = genre_list
.iter()
.take(20)
Expand All @@ -409,7 +409,7 @@ impl Renamer {
for (genre, count) in genre_list.iter().take(20) {
println!("{genre:<width$} {count}", width = max_lenght);
}
genre_list.sort();
genre_list.sort_unstable();
utils::write_genre_log(&genre_list)?;
}

Expand All @@ -430,7 +430,7 @@ impl Renamer {
let mut counts: Vec<(&String, &usize)> = file_format_counts.iter().collect();

// Sort the Vec in decreasing order
counts.sort_by(|a, b| b.1.cmp(a.1));
counts.sort_unstable_by(|a, b| b.1.cmp(a.1));

println!("{}", "File format counts:".bold());
for (format, count) in counts {
Expand All @@ -451,7 +451,7 @@ impl Renamer {
return;
}

duplicate_tracks.sort();
duplicate_tracks.sort_unstable();

println!(
"{}",
Expand Down

0 comments on commit 6908ad4

Please sign in to comment.