about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAda Alakbarova <ada.alakbarova@proton.me>2025-08-06 23:04:49 +0200
committerAda Alakbarova <ada.alakbarova@proton.me>2025-08-22 15:03:23 +0200
commita4dbbc9bf1cea10b396eec28e052a5096dc7da29 (patch)
tree9a0d0aca2ca429ec819146fe515c0bfb3b2e45a9
parentcd2d2a034d4e88ac6a3635c6a0cf2079eedecc21 (diff)
downloadrust-a4dbbc9bf1cea10b396eec28e052a5096dc7da29.tar.gz
rust-a4dbbc9bf1cea10b396eec28e052a5096dc7da29.zip
rename recursive function call
-rw-r--r--clippy_utils/src/check_proc_macro.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/clippy_utils/src/check_proc_macro.rs b/clippy_utils/src/check_proc_macro.rs
index d569865553a..1ea68c1c221 100644
--- a/clippy_utils/src/check_proc_macro.rs
+++ b/clippy_utils/src/check_proc_macro.rs
@@ -413,10 +413,12 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
 }
 
 fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
-    match ty.kind {
+    use ast::{FnRetTy, MutTy, TyKind};
+
+    match &ty.kind {
         TyKind::Slice(..) | TyKind::Array(..) => (Pat::Str("["), Pat::Str("]")),
-        TyKind::Ptr(MutTy { ty, .. }) => (Pat::Str("*"), ty_search_pat(ty).1),
-        TyKind::Ref(_, MutTy { ty, .. }) => (Pat::Str("&"), ty_search_pat(ty).1),
+        TyKind::Ptr(MutTy { ty, .. }) => (Pat::Str("*"), ast_ty_search_pat(ty).1),
+        TyKind::Ref(_, MutTy { ty, .. }) => (Pat::Str("&"), ast_ty_search_pat(ty).1),
         TyKind::FnPtr(fn_ptr) => (
             if fn_ptr.safety.is_unsafe() {
                 Pat::Str("unsafe")
@@ -428,20 +430,20 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
             match fn_ptr.decl.output {
                 FnRetTy::DefaultReturn(_) => {
                     if let [.., ty] = fn_ptr.decl.inputs {
-                        ty_search_pat(ty).1
+                        ast_ty_search_pat(ty).1
                     } else {
                         Pat::Str("(")
                     }
                 },
-                FnRetTy::Return(ty) => ty_search_pat(ty).1,
+                FnRetTy::Return(ty) => ast_ty_search_pat(ty).1,
             },
         ),
         TyKind::Never => (Pat::Str("!"), Pat::Str("!")),
         // Parenthesis are trimmed from the text before the search patterns are matched.
         // See: `span_matches_pat`
         TyKind::Tup([]) => (Pat::Str(")"), Pat::Str("(")),
-        TyKind::Tup([ty]) => ty_search_pat(ty),
-        TyKind::Tup([head, .., tail]) => (ty_search_pat(head).0, ty_search_pat(tail).1),
+        TyKind::Tup([ty]) => ast_ty_search_pat(ty),
+        TyKind::Tup([head, .., tail]) => (ast_ty_search_pat(head).0, ast_ty_search_pat(tail).1),
         TyKind::OpaqueDef(..) => (Pat::Str("impl"), Pat::Str("")),
         TyKind::Path(qpath) => qpath_search_pat(&qpath),
         TyKind::Infer(()) => (Pat::Str("_"), Pat::Str("_")),