Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fb6bf1e

Browse files
committed
update a func
1 parent 450a22f commit fb6bf1e

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

clippy_lints/src/matches/redundant_pattern_match.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,7 @@ fn found_good_method<'a>(
289289
None
290290
}
291291
},
292-
(PatKind::Path(ref path_left), PatKind::Wild) => {
293-
if let Some(name) = get_ident(path_left) {
294-
match name.as_str() {
295-
"None" => find_good_method_for_matches_macro(
296-
cx,
297-
arms,
298-
path_left,
299-
Item::Lang(OptionNone),
300-
"is_none()",
301-
"is_some()",
302-
),
303-
_ => None,
304-
}
305-
} else {
306-
None
307-
}
308-
},
292+
(PatKind::Path(ref path_left), PatKind::Wild) => get_good_method(cx, arms, path_left),
309293
_ => None,
310294
}
311295
}
@@ -334,6 +318,14 @@ fn get_good_method<'a>(cx: &LateContext<'_>, arms: &[Arm<'_>], path_left: &QPath
334318
"is_some()",
335319
"is_none()",
336320
),
321+
"None" => find_good_method_for_matches_macro(
322+
cx,
323+
arms,
324+
path_left,
325+
Item::Lang(OptionNone),
326+
"is_none()",
327+
"is_some()",
328+
),
337329
_ => None,
338330
};
339331
}

0 commit comments

Comments
 (0)