@@ -197,7 +197,7 @@ declare_clippy_lint! {
197
197
198
198
declare_clippy_lint ! {
199
199
/// **What it does:** Checks for tuple patterns with a wildcard
200
- /// pattern (`_`) is next to a rest pattern (`..`) pattern .
200
+ /// pattern (`_`) is next to a rest pattern (`..`).
201
201
///
202
202
/// **Why is this bad?** The wildcard pattern is unneeded as the rest pattern
203
203
/// can match that element as well.
@@ -226,7 +226,7 @@ declare_clippy_lint! {
226
226
/// ```
227
227
pub UNNEEDED_WILDCARD_PATTERN ,
228
228
complexity,
229
- "tuple patterns with a wildcard pattern (`_`) is next to a rest pattern (`..`) pattern "
229
+ "tuple patterns with a wildcard pattern (`_`) is next to a rest pattern (`..`)"
230
230
}
231
231
232
232
declare_lint_pass ! ( MiscEarlyLints => [
@@ -576,14 +576,6 @@ fn check_unneeded_wildcard_pattern(cx: &EarlyContext<'_>, pat: &Pat) {
576
576
) ;
577
577
}
578
578
579
- fn is_rest < P : std:: ops:: Deref < Target = Pat > > ( pat : & P ) -> bool {
580
- if let PatKind :: Rest = pat. node {
581
- true
582
- } else {
583
- false
584
- }
585
- }
586
-
587
579
#[ allow( clippy:: trivially_copy_pass_by_ref) ]
588
580
fn is_wild < P : std:: ops:: Deref < Target = Pat > > ( pat : & & P ) -> bool {
589
581
if let PatKind :: Wild = pat. node {
@@ -593,7 +585,7 @@ fn check_unneeded_wildcard_pattern(cx: &EarlyContext<'_>, pat: &Pat) {
593
585
}
594
586
}
595
587
596
- if let Some ( rest_index) = patterns. iter ( ) . position ( is_rest) {
588
+ if let Some ( rest_index) = patterns. iter ( ) . position ( |pat| pat . is_rest ( ) ) {
597
589
if let Some ( ( left_index, left_pat) ) = patterns[ ..rest_index]
598
590
. iter ( )
599
591
. rev ( )
0 commit comments