Skip to content

Commit ed5f631

Browse files
committed
use Reverse instead of manually doing reverse comparison
1 parent 8e59cf9 commit ed5f631

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::cmp::Reverse;
2+
13
use rustc_ast::expand::StrippedCfgItem;
24
use rustc_ast::ptr::P;
35
use rustc_ast::visit::{self, Visitor};
@@ -2357,7 +2359,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23572359
// 2) `std` suggestions before `core` suggestions.
23582360
let mut extern_crate_names =
23592361
self.extern_prelude.keys().map(|ident| ident.name).collect::<Vec<_>>();
2360-
extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap());
2362+
extern_crate_names.sort_by_key(|&name| Reverse(name));
23612363

23622364
for name in extern_crate_names.into_iter() {
23632365
// Replace first ident with a crate name and check if that is valid.

0 commit comments

Comments
 (0)