@@ -413,10 +413,12 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
413
413
}
414
414
415
415
fn ast_ty_search_pat ( ty : & ast:: Ty ) -> ( Pat , Pat ) {
416
- match ty. kind {
416
+ use ast:: { FnRetTy , MutTy , TyKind } ;
417
+
418
+ match & ty. kind {
417
419
TyKind :: Slice ( ..) | TyKind :: Array ( ..) => ( Pat :: Str ( "[" ) , Pat :: Str ( "]" ) ) ,
418
- TyKind :: Ptr ( MutTy { ty, .. } ) => ( Pat :: Str ( "*" ) , ty_search_pat ( ty) . 1 ) ,
419
- TyKind :: Ref ( _, MutTy { ty, .. } ) => ( Pat :: Str ( "&" ) , ty_search_pat ( ty) . 1 ) ,
420
+ TyKind :: Ptr ( MutTy { ty, .. } ) => ( Pat :: Str ( "*" ) , ast_ty_search_pat ( ty) . 1 ) ,
421
+ TyKind :: Ref ( _, MutTy { ty, .. } ) => ( Pat :: Str ( "&" ) , ast_ty_search_pat ( ty) . 1 ) ,
420
422
TyKind :: FnPtr ( fn_ptr) => (
421
423
if fn_ptr. safety . is_unsafe ( ) {
422
424
Pat :: Str ( "unsafe" )
@@ -428,20 +430,20 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
428
430
match fn_ptr. decl . output {
429
431
FnRetTy :: DefaultReturn ( _) => {
430
432
if let [ .., ty] = fn_ptr. decl . inputs {
431
- ty_search_pat ( ty) . 1
433
+ ast_ty_search_pat ( ty) . 1
432
434
} else {
433
435
Pat :: Str ( "(" )
434
436
}
435
437
} ,
436
- FnRetTy :: Return ( ty) => ty_search_pat ( ty) . 1 ,
438
+ FnRetTy :: Return ( ty) => ast_ty_search_pat ( ty) . 1 ,
437
439
} ,
438
440
) ,
439
441
TyKind :: Never => ( Pat :: Str ( "!" ) , Pat :: Str ( "!" ) ) ,
440
442
// Parenthesis are trimmed from the text before the search patterns are matched.
441
443
// See: `span_matches_pat`
442
444
TyKind :: Tup ( [ ] ) => ( Pat :: Str ( ")" ) , Pat :: Str ( "(" ) ) ,
443
- TyKind :: Tup ( [ ty] ) => ty_search_pat ( ty) ,
444
- TyKind :: Tup ( [ head, .., tail] ) => ( ty_search_pat ( head) . 0 , ty_search_pat ( tail) . 1 ) ,
445
+ TyKind :: Tup ( [ ty] ) => ast_ty_search_pat ( ty) ,
446
+ TyKind :: Tup ( [ head, .., tail] ) => ( ast_ty_search_pat ( head) . 0 , ast_ty_search_pat ( tail) . 1 ) ,
445
447
TyKind :: OpaqueDef ( ..) => ( Pat :: Str ( "impl" ) , Pat :: Str ( "" ) ) ,
446
448
TyKind :: Path ( qpath) => qpath_search_pat ( & qpath) ,
447
449
TyKind :: Infer ( ( ) ) => ( Pat :: Str ( "_" ) , Pat :: Str ( "_" ) ) ,
0 commit comments