Skip to content

Commit 8ae8b08

Browse files
committed
Change lint name to WILDCARD_IN_OR_PATTERNS
1 parent 58deaad commit 8ae8b08

9 files changed

+25
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,6 @@ Released 2018-09-13
12411241
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
12421242
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
12431243
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
1244-
[`pats_with_wild_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#pats_with_wild_match_arm
12451244
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
12461245
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence
12471246
[`print_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
@@ -1362,6 +1361,7 @@ Released 2018-09-13
13621361
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
13631362
[`wildcard_dependencies`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies
13641363
[`wildcard_enum_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm
1364+
[`wildcard_in_or_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_in_or_patterns
13651365
[`write_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_literal
13661366
[`write_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline
13671367
[`writeln_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#writeln_empty_string

clippy_lints/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,10 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
597597
&matches::MATCH_OVERLAPPING_ARM,
598598
&matches::MATCH_REF_PATS,
599599
&matches::MATCH_WILD_ERR_ARM,
600-
&matches::PATS_WITH_WILD_MATCH_ARM,
601600
&matches::SINGLE_MATCH,
602601
&matches::SINGLE_MATCH_ELSE,
603602
&matches::WILDCARD_ENUM_MATCH_ARM,
603+
&matches::WILDCARD_IN_OR_PATTERNS,
604604
&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
605605
&mem_forget::MEM_FORGET,
606606
&mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
@@ -1188,8 +1188,8 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
11881188
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
11891189
LintId::of(&matches::MATCH_REF_PATS),
11901190
LintId::of(&matches::MATCH_WILD_ERR_ARM),
1191-
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
11921191
LintId::of(&matches::SINGLE_MATCH),
1192+
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
11931193
LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
11941194
LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
11951195
LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
@@ -1463,7 +1463,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
14631463
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
14641464
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
14651465
LintId::of(&matches::MATCH_AS_REF),
1466-
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
1466+
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
14671467
LintId::of(&methods::CHARS_NEXT_CMP),
14681468
LintId::of(&methods::CLONE_ON_COPY),
14691469
LintId::of(&methods::FILTER_NEXT),

clippy_lints/src/matches.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ declare_clippy_lint! {
238238
/// "bar" | _ => {},
239239
/// }
240240
/// ```
241-
pub PATS_WITH_WILD_MATCH_ARM,
241+
pub WILDCARD_IN_OR_PATTERNS,
242242
complexity,
243243
"a wildcard pattern used with others patterns in same match arm"
244244
}
@@ -252,7 +252,7 @@ declare_lint_pass!(Matches => [
252252
MATCH_WILD_ERR_ARM,
253253
MATCH_AS_REF,
254254
WILDCARD_ENUM_MATCH_ARM,
255-
PATS_WITH_WILD_MATCH_ARM
255+
WILDCARD_IN_OR_PATTERNS
256256
]);
257257

258258
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
@@ -267,7 +267,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
267267
check_wild_err_arm(cx, ex, arms);
268268
check_wild_enum_match(cx, ex, arms);
269269
check_match_as_ref(cx, ex, arms, expr);
270-
check_pats_wild_match(cx, ex, arms);
270+
check_wild_in_or_pats(cx, ex, arms);
271271
}
272272
if let ExprKind::Match(ref ex, ref arms, _) = expr.kind {
273273
check_match_ref_pats(cx, ex, arms, expr);
@@ -686,7 +686,7 @@ fn check_match_as_ref(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>],
686686
}
687687
}
688688

689-
fn check_pats_wild_match(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
689+
fn check_wild_in_or_pats(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>]) {
690690
let mut is_non_exhaustive_enum = false;
691691
let ty = cx.tables.expr_ty(ex);
692692
if ty.is_enum() {
@@ -703,7 +703,7 @@ fn check_pats_wild_match(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_
703703
if fields.len() > 1 && fields.iter().any(is_wild) {
704704
span_lint_and_then(
705705
cx,
706-
PATS_WITH_WILD_MATCH_ARM,
706+
WILDCARD_IN_OR_PATTERNS,
707707
arm.pat.span,
708708
"wildcard pattern covers any other pattern as it will match anyway.",
709709
|db| {

src/lintlist/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,13 +1568,6 @@ pub const ALL_LINTS: [Lint; 345] = [
15681568
deprecation: None,
15691569
module: "path_buf_push_overwrite",
15701570
},
1571-
Lint {
1572-
name: "pats_with_wild_match_arm",
1573-
group: "complexity",
1574-
desc: "a wildcard pattern used with others patterns in same match arm",
1575-
deprecation: None,
1576-
module: "matches",
1577-
},
15781571
Lint {
15791572
name: "possible_missing_comma",
15801573
group: "correctness",
@@ -2352,6 +2345,13 @@ pub const ALL_LINTS: [Lint; 345] = [
23522345
deprecation: None,
23532346
module: "matches",
23542347
},
2348+
Lint {
2349+
name: "wildcard_in_or_patterns",
2350+
group: "complexity",
2351+
desc: "a wildcard pattern used with others patterns in same match arm",
2352+
deprecation: None,
2353+
module: "matches",
2354+
},
23552355
Lint {
23562356
name: "write_literal",
23572357
group: "style",

tests/ui/pats_with_wild_match_arm.fixed renamed to tests/ui/wild_in_or_pats.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![warn(clippy::pats_with_wild_match_arm)]
3+
#![warn(clippy::wildcard_in_or_patterns)]
44

55
fn main() {
66
match "foo" {

tests/ui/pats_with_wild_match_arm.rs renamed to tests/ui/wild_in_or_pats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![warn(clippy::pats_with_wild_match_arm)]
3+
#![warn(clippy::wildcard_in_or_patterns)]
44

55
fn main() {
66
match "foo" {

tests/ui/pats_with_wild_match_arm.stderr renamed to tests/ui/wild_in_or_pats.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: wildcard pattern covers any other pattern as it will match anyway.
2-
--> $DIR/pats_with_wild_match_arm.rs:10:9
2+
--> $DIR/wild_in_or_pats.rs:10:9
33
|
44
LL | "bar" | _ => {
55
| ^^^^^^^^^ help: consider replacing with wildcard pattern only: `_`
66
|
7-
= note: `-D clippy::pats-with-wild-match-arm` implied by `-D warnings`
7+
= note: `-D clippy::wildcard-in-or-patterns` implied by `-D warnings`
88

99
error: wildcard pattern covers any other pattern as it will match anyway.
10-
--> $DIR/pats_with_wild_match_arm.rs:18:9
10+
--> $DIR/wild_in_or_pats.rs:18:9
1111
|
1212
LL | "bar" | "bar2" | _ => {
1313
| ^^^^^^^^^^^^^^^^^^ help: consider replacing with wildcard pattern only: `_`
1414

1515
error: wildcard pattern covers any other pattern as it will match anyway.
16-
--> $DIR/pats_with_wild_match_arm.rs:26:9
16+
--> $DIR/wild_in_or_pats.rs:26:9
1717
|
1818
LL | _ | "bar" | _ => {
1919
| ^^^^^^^^^^^^^ help: consider replacing with wildcard pattern only: `_`
2020

2121
error: wildcard pattern covers any other pattern as it will match anyway.
22-
--> $DIR/pats_with_wild_match_arm.rs:34:9
22+
--> $DIR/wild_in_or_pats.rs:34:9
2323
|
2424
LL | _ | "bar" => {
2525
| ^^^^^^^^^ help: consider replacing with wildcard pattern only: `_`

tests/ui/wildcard_enum_match_arm.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
unused_variables,
77
dead_code,
88
clippy::single_match,
9-
clippy::pats_with_wild_match_arm
9+
clippy::wildcard_in_or_patterns
1010
)]
1111

1212
use std::io::ErrorKind;

tests/ui/wildcard_enum_match_arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
unused_variables,
77
dead_code,
88
clippy::single_match,
9-
clippy::pats_with_wild_match_arm
9+
clippy::wildcard_in_or_patterns
1010
)]
1111

1212
use std::io::ErrorKind;

0 commit comments

Comments
 (0)