Skip to content

Commit 2097896

Browse files
committed
sort_by_key to reduce clutter
1 parent 01594b5 commit 2097896

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ fn get_authors(n: usize) -> Vec<String> {
288288

289289
// sort authors by commit count where the one with most commit count is first
290290
let mut authors: Vec<(String, usize)> = authors.into_iter().collect();
291-
authors.sort_by(|(_, count1), (_, count2)| count2.cmp(count1));
291+
authors.sort_by_key(|(_, c)| *c);
292292

293293
// truncate the vector so we only get the count of authors we specified as 'n'
294294
authors.truncate(n);

0 commit comments

Comments
 (0)