Skip to content

Commit ad16718

Browse files
committed
Change lint name to WILDCARD_IN_OR_PATTERNS
1 parent cd3dcf9 commit ad16718

10 files changed

+27
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,6 @@ Released 2018-09-13
12401240
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
12411241
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
12421242
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
1243-
[`pats_with_wild_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#pats_with_wild_match_arm
12441243
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
12451244
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence
12461245
[`print_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
@@ -1361,6 +1360,7 @@ Released 2018-09-13
13611360
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
13621361
[`wildcard_dependencies`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies
13631362
[`wildcard_enum_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm
1363+
[`wildcard_in_or_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_in_or_patterns
13641364
[`write_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_literal
13651365
[`write_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline
13661366
[`writeln_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#writeln_empty_string

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are 344 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are 345 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1212

clippy_lints/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,10 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
593593
&matches::MATCH_OVERLAPPING_ARM,
594594
&matches::MATCH_REF_PATS,
595595
&matches::MATCH_WILD_ERR_ARM,
596-
&matches::PATS_WITH_WILD_MATCH_ARM,
597596
&matches::SINGLE_MATCH,
598597
&matches::SINGLE_MATCH_ELSE,
599598
&matches::WILDCARD_ENUM_MATCH_ARM,
599+
&matches::WILDCARD_IN_OR_PATTERNS,
600600
&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM,
601601
&mem_forget::MEM_FORGET,
602602
&mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
@@ -1182,8 +1182,8 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
11821182
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
11831183
LintId::of(&matches::MATCH_REF_PATS),
11841184
LintId::of(&matches::MATCH_WILD_ERR_ARM),
1185-
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
11861185
LintId::of(&matches::SINGLE_MATCH),
1186+
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
11871187
LintId::of(&mem_discriminant::MEM_DISCRIMINANT_NON_ENUM),
11881188
LintId::of(&mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
11891189
LintId::of(&mem_replace::MEM_REPLACE_WITH_DEFAULT),
@@ -1457,7 +1457,7 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
14571457
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
14581458
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
14591459
LintId::of(&matches::MATCH_AS_REF),
1460-
LintId::of(&matches::PATS_WITH_WILD_MATCH_ARM),
1460+
LintId::of(&matches::WILDCARD_IN_OR_PATTERNS),
14611461
LintId::of(&methods::CHARS_NEXT_CMP),
14621462
LintId::of(&methods::CLONE_ON_COPY),
14631463
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use lint::Lint;
66
pub use lint::LINT_LEVELS;
77

88
// begin lint list, do not remove this comment, it’s used in `update_lints`
9-
pub const ALL_LINTS: [Lint; 344] = [
9+
pub const ALL_LINTS: [Lint; 345] = [
1010
Lint {
1111
name: "absurd_extreme_comparisons",
1212
group: "correctness",
@@ -1561,13 +1561,6 @@ pub const ALL_LINTS: [Lint; 344] = [
15611561
deprecation: None,
15621562
module: "path_buf_push_overwrite",
15631563
},
1564-
Lint {
1565-
name: "pats_with_wild_match_arm",
1566-
group: "complexity",
1567-
desc: "a wildcard pattern used with others patterns in same match arm",
1568-
deprecation: None,
1569-
module: "matches",
1570-
},
15711564
Lint {
15721565
name: "possible_missing_comma",
15731566
group: "correctness",
@@ -2345,6 +2338,13 @@ pub const ALL_LINTS: [Lint; 344] = [
23452338
deprecation: None,
23462339
module: "matches",
23472340
},
2341+
Lint {
2342+
name: "wildcard_in_or_patterns",
2343+
group: "complexity",
2344+
desc: "a wildcard pattern used with others patterns in same match arm",
2345+
deprecation: None,
2346+
module: "matches",
2347+
},
23482348
Lint {
23492349
name: "write_literal",
23502350
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)