Skip to content

Commit

Permalink
Deduplicate binapps by path
Browse files Browse the repository at this point in the history
  • Loading branch information
l4l committed Dec 27, 2020
1 parent 4946167 commit c6b73f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mode/bins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ impl BinsMode {
})
.collect();

bins.sort_by_key(|b| Reverse(usage.entry_count(b.to_str().unwrap())));
bins.sort_by(|x, y| {
let x_usage_count = usage.entry_count(x.to_str().unwrap());
let y_usage_count = usage.entry_count(y.to_str().unwrap());

Reverse(x_usage_count)
.cmp(&Reverse(y_usage_count))
.then_with(|| x.cmp(&y))
});
bins.dedup();

Self { bins, term, usage }
}
Expand Down

0 comments on commit c6b73f2

Please sign in to comment.