Skip to content

Commit ea32862

Browse files
authored
Use sort_by_key rather than sort_by
1 parent f93827f commit ea32862

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_errors/emitter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ impl EmitterWriter {
954954
// | | |
955955
// | | something about `foo`
956956
// | something about `fn foo()`
957-
annotations_position.sort_by(|a, b| {
957+
annotations_position.sort_by_key(|x| {
958958
// Decreasing order. When `a` and `b` are the same length, prefer `Primary`.
959-
(a.1.len(), !a.1.is_primary).cmp(&(b.1.len(), !b.1.is_primary)).reverse()
959+
(Reverse(a.1.len()), a.1.is_primary)
960960
});
961961

962962
// Write the underlines.

0 commit comments

Comments
 (0)