about summary refs log tree commit diff
diff options
context:
space:
mode:
authordisco07 <koneenok@outlook.fr>2023-05-07 08:12:36 +0200
committerdisco07 <koneenok@outlook.fr>2023-05-07 08:12:36 +0200
commitfb6bf1ebf66497386ea4c90a953b7b287ae19706 (patch)
tree2a266f82705fe38b4ca9f2930ae4b3728a2e8945
parent450a22f2dc18949ba2db96570dc5270060fabd43 (diff)
downloadrust-fb6bf1ebf66497386ea4c90a953b7b287ae19706.tar.gz
rust-fb6bf1ebf66497386ea4c90a953b7b287ae19706.zip
update a func
-rw-r--r--clippy_lints/src/matches/redundant_pattern_match.rs26
1 files changed, 9 insertions, 17 deletions
diff --git a/clippy_lints/src/matches/redundant_pattern_match.rs b/clippy_lints/src/matches/redundant_pattern_match.rs
index 2ac6d9938eb..28478987821 100644
--- a/clippy_lints/src/matches/redundant_pattern_match.rs
+++ b/clippy_lints/src/matches/redundant_pattern_match.rs
@@ -289,23 +289,7 @@ fn found_good_method<'a>(
                 None
             }
         },
-        (PatKind::Path(ref path_left), PatKind::Wild) => {
-            if let Some(name) = get_ident(path_left) {
-                match name.as_str() {
-                    "None" => find_good_method_for_matches_macro(
-                        cx,
-                        arms,
-                        path_left,
-                        Item::Lang(OptionNone),
-                        "is_none()",
-                        "is_some()",
-                    ),
-                    _ => None,
-                }
-            } else {
-                None
-            }
-        },
+        (PatKind::Path(ref path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
         _ => None,
     }
 }
@@ -334,6 +318,14 @@ fn get_good_method<'a>(cx: &LateContext<'_>, arms: &[Arm<'_>], path_left: &QPath
                 "is_some()",
                 "is_none()",
             ),
+            "None" => find_good_method_for_matches_macro(
+                cx,
+                arms,
+                path_left,
+                Item::Lang(OptionNone),
+                "is_none()",
+                "is_some()",
+            ),
             _ => None,
         };
     }