@@ -1127,7 +1127,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
1127
1127
} ) ;
1128
1128
1129
1129
// Make sure error reporting is deterministic.
1130
- suggestions. sort_by ( |a, b| a. candidate . as_str ( ) . partial_cmp ( b. candidate . as_str ( ) ) . unwrap ( ) ) ;
1130
+ suggestions. sort_by ( |a, b| a. candidate . as_str ( ) . cmp ( b. candidate . as_str ( ) ) ) ;
1131
1131
1132
1132
match find_best_match_for_name (
1133
1133
& suggestions. iter ( ) . map ( |suggestion| suggestion. candidate ) . collect :: < Vec < Symbol > > ( ) ,
@@ -2256,14 +2256,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2256
2256
mut path : Vec < Segment > ,
2257
2257
parent_scope : & ParentScope < ' ra > ,
2258
2258
) -> Option < ( Vec < Segment > , Option < String > ) > {
2259
- match ( path. get ( 0 ) , path . get ( 1 ) ) {
2259
+ match path[ .. ] {
2260
2260
// `{{root}}::ident::...` on both editions.
2261
2261
// On 2015 `{{root}}` is usually added implicitly.
2262
- ( Some ( fst ) , Some ( snd ) )
2263
- if fst . ident . name == kw:: PathRoot && !snd . ident . is_path_segment_keyword ( ) => { }
2262
+ [ first , second , .. ]
2263
+ if first . ident . name == kw:: PathRoot && !second . ident . is_path_segment_keyword ( ) => { }
2264
2264
// `ident::...` on 2018.
2265
- ( Some ( fst) , _)
2266
- if fst. ident . span . at_least_rust_2018 ( ) && !fst. ident . is_path_segment_keyword ( ) =>
2265
+ [ first, ..]
2266
+ if first. ident . span . at_least_rust_2018 ( )
2267
+ && !first. ident . is_path_segment_keyword ( ) =>
2267
2268
{
2268
2269
// Insert a placeholder that's later replaced by `self`/`super`/etc.
2269
2270
path. insert ( 0 , Segment :: from_ident ( Ident :: empty ( ) ) ) ;
@@ -2374,7 +2375,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
2374
2375
// 2) `std` suggestions before `core` suggestions.
2375
2376
let mut extern_crate_names =
2376
2377
self . extern_prelude . keys ( ) . map ( |ident| ident. name ) . collect :: < Vec < _ > > ( ) ;
2377
- extern_crate_names. sort_by ( |a, b| b. as_str ( ) . partial_cmp ( a. as_str ( ) ) . unwrap ( ) ) ;
2378
+ extern_crate_names. sort_by ( |a, b| b. as_str ( ) . cmp ( a. as_str ( ) ) ) ;
2378
2379
2379
2380
for name in extern_crate_names. into_iter ( ) {
2380
2381
// Replace first ident with a crate name and check if that is valid.
0 commit comments