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