@@ -413,10 +413,12 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
413413}
414414
415415fn ast_ty_search_pat ( ty : & ast:: Ty ) -> ( Pat , Pat ) {
416- match ty. kind {
416+ use ast:: { FnRetTy , MutTy , TyKind } ;
417+
418+ match & ty. kind {
417419 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 ) ,
420422 TyKind :: FnPtr ( fn_ptr) => (
421423 if fn_ptr. safety . is_unsafe ( ) {
422424 Pat :: Str ( "unsafe" )
@@ -428,20 +430,20 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
428430 match fn_ptr. decl . output {
429431 FnRetTy :: DefaultReturn ( _) => {
430432 if let [ .., ty] = fn_ptr. decl . inputs {
431- ty_search_pat ( ty) . 1
433+ ast_ty_search_pat ( ty) . 1
432434 } else {
433435 Pat :: Str ( "(" )
434436 }
435437 } ,
436- FnRetTy :: Return ( ty) => ty_search_pat ( ty) . 1 ,
438+ FnRetTy :: Return ( ty) => ast_ty_search_pat ( ty) . 1 ,
437439 } ,
438440 ) ,
439441 TyKind :: Never => ( Pat :: Str ( "!" ) , Pat :: Str ( "!" ) ) ,
440442 // Parenthesis are trimmed from the text before the search patterns are matched.
441443 // See: `span_matches_pat`
442444 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 ) ,
445447 TyKind :: OpaqueDef ( ..) => ( Pat :: Str ( "impl" ) , Pat :: Str ( "" ) ) ,
446448 TyKind :: Path ( qpath) => qpath_search_pat ( & qpath) ,
447449 TyKind :: Infer ( ( ) ) => ( Pat :: Str ( "_" ) , Pat :: Str ( "_" ) ) ,
0 commit comments