From afebb4862e706cf083575f4ce8621a5ab0a2f384 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Thu, 10 Jan 2019 14:56:28 -0600 Subject: [PATCH 01/11] Add match_wild lint (#3649). This lint prevents using a wildcard in a match. --- clippy_lints/src/matches.rs | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index b290980fc361..4be045175bb2 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -187,6 +187,25 @@ declare_clippy_lint! { "a match on an Option value instead of using `as_ref()` or `as_mut`" } +/// **What it does:** Checks for wildcard matches using `_`. +/// +/// **Why is this bad?** New variants added by library updates can be missed. +/// +/// **Known problems:** None. +/// +/// **Example:** +/// ```rust +/// match x { +/// A => {}, +/// _ => {} +/// } +/// ``` +declare_clippy_lint! { + pub MATCH_WILD, + restriction, + "a wildcard match arm using `_`" +} + #[allow(missing_copy_implementations)] pub struct MatchPass; @@ -199,7 +218,8 @@ impl LintPass for MatchPass { SINGLE_MATCH_ELSE, MATCH_OVERLAPPING_ARM, MATCH_WILD_ERR_ARM, - MATCH_AS_REF + MATCH_AS_REF, + MATCH_WILD ) } @@ -218,6 +238,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { check_match_bool(cx, ex, arms, expr); check_overlapping_arms(cx, ex, arms); check_wild_err_arm(cx, ex, arms); + check_wild_arm(cx, ex, arms); check_match_as_ref(cx, ex, arms, expr); } if let ExprKind::Match(ref ex, ref arms, _) = expr.node { @@ -442,6 +463,22 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { } } +fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { + let ex_ty = walk_ptrs_ty(cx.tables.expr_ty(ex)); + if match_type(cx, ex_ty, &paths::RESULT) { + for arm in arms { + if is_wild(&arm.pats[0]) { + span_note_and_lint(cx, + MATCH_WILD, + arm.pats[0].span, + "Wildcard match will miss any future added variants.", + arm.pats[0].span, + "to resolve, match each variant explicitly"); + } + } + } +} + // If the block contains only a `panic!` macro (as expression or statement) fn is_panic_block(block: &Block) -> bool { match (&block.expr, block.stmts.len(), block.stmts.first()) { From ff449d70abe650077a65459036ad747d06059174 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Sat, 12 Jan 2019 17:45:16 -0600 Subject: [PATCH 02/11] Change match_wild lint name to WILDCARD_MATCH_ARM. Also fix message capitalization. --- clippy_lints/src/matches.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 4be045175bb2..bdade6ee19e7 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -201,7 +201,7 @@ declare_clippy_lint! { /// } /// ``` declare_clippy_lint! { - pub MATCH_WILD, + pub WILDCARD_MATCH_ARM, restriction, "a wildcard match arm using `_`" } @@ -219,7 +219,7 @@ impl LintPass for MatchPass { MATCH_OVERLAPPING_ARM, MATCH_WILD_ERR_ARM, MATCH_AS_REF, - MATCH_WILD + WILDCARD_MATCH_ARM ) } @@ -469,9 +469,9 @@ fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { for arm in arms { if is_wild(&arm.pats[0]) { span_note_and_lint(cx, - MATCH_WILD, + WILDCARD_MATCH_ARM, arm.pats[0].span, - "Wildcard match will miss any future added variants.", + "wildcard match will miss any future added variants.", arm.pats[0].span, "to resolve, match each variant explicitly"); } From e5aee045752360bcdd572dfe665bb3da283605f3 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Fri, 25 Jan 2019 10:39:09 -0600 Subject: [PATCH 03/11] wildcard_match_arm: expand lint scope. We're not only working with Results. --- clippy_lints/src/matches.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index bdade6ee19e7..9d4279ad1bc3 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -464,17 +464,14 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { } fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { - let ex_ty = walk_ptrs_ty(cx.tables.expr_ty(ex)); - if match_type(cx, ex_ty, &paths::RESULT) { - for arm in arms { - if is_wild(&arm.pats[0]) { - span_note_and_lint(cx, - WILDCARD_MATCH_ARM, - arm.pats[0].span, - "wildcard match will miss any future added variants.", - arm.pats[0].span, - "to resolve, match each variant explicitly"); - } + for arm in arms { + if is_wild(&arm.pats[0]) { + span_note_and_lint(cx, + WILDCARD_MATCH_ARM, + arm.pats[0].span, + "wildcard match will miss any future added variants.", + arm.pats[0].span, + "to resolve, match each variant explicitly"); } } } From e80da4846670692a9ff1464e74101021e0e71454 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Fri, 25 Jan 2019 10:42:11 -0600 Subject: [PATCH 04/11] wildcard_match_arm: add simple ui test. --- tests/ui/wildcard_match_arm.rs | 36 ++++++++++++++++++++++++++++++ tests/ui/wildcard_match_arm.stderr | 15 +++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/ui/wildcard_match_arm.rs create mode 100644 tests/ui/wildcard_match_arm.stderr diff --git a/tests/ui/wildcard_match_arm.rs b/tests/ui/wildcard_match_arm.rs new file mode 100644 index 000000000000..26a37c969a39 --- /dev/null +++ b/tests/ui/wildcard_match_arm.rs @@ -0,0 +1,36 @@ +#![deny(clippy::wildcard_match_arm)] + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +enum Color { + Red, + Green, + Blue, + Rgb(u8, u8, u8), + Cyan, +} + +impl Color { + fn is_monochrome(self) -> bool { + match self { + Color::Red | Color::Green | Color::Blue => true, + Color::Rgb(r, g, b) => r | g == 0 || r | b == 0 || g | b == 0, + Color::Cyan => false, + } + } +} + +fn main() { + let color = Color::Rgb(0, 0, 127); + match color { + Color::Red => println!("Red"), + _ => eprintln!("Not red"), + }; + match color { + Color::Red => {}, + Color::Green => {}, + Color::Blue => {}, + Color::Cyan => {}, + c if c.is_monochrome() => {}, + Color::Rgb(_, _, _) => {}, + }; +} \ No newline at end of file diff --git a/tests/ui/wildcard_match_arm.stderr b/tests/ui/wildcard_match_arm.stderr new file mode 100644 index 000000000000..0d10382dc158 --- /dev/null +++ b/tests/ui/wildcard_match_arm.stderr @@ -0,0 +1,15 @@ +error: wildcard match will miss any future added variants. + --> $DIR/wildcard_match_arm.rs:26:3 + | +LL | _ => eprintln!("Not red"), + | ^ + | +note: lint level defined here + --> $DIR/wildcard_match_arm.rs:1:9 + | +LL | #![deny(clippy::wildcard_match_arm)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: to resolve, match each variant explicitly + +error: aborting due to previous error + From 0406f0f25b819f6373890564e5a57426301475c7 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Fri, 25 Jan 2019 10:56:00 -0600 Subject: [PATCH 05/11] wildcard_match_arm: rename function. We also don't need `ex` as an argument. --- clippy_lints/src/matches.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 9d4279ad1bc3..024c88b368c5 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -238,7 +238,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { check_match_bool(cx, ex, arms, expr); check_overlapping_arms(cx, ex, arms); check_wild_err_arm(cx, ex, arms); - check_wild_arm(cx, ex, arms); + check_wild_match(cx, arms); check_match_as_ref(cx, ex, arms, expr); } if let ExprKind::Match(ref ex, ref arms, _) = expr.node { @@ -463,7 +463,7 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { } } -fn check_wild_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { +fn check_wild_match(cx: &LateContext<'_, '_>, arms: &[Arm]) { for arm in arms { if is_wild(&arm.pats[0]) { span_note_and_lint(cx, From c51d8ac69d69572304b73e69a34fc1c75015cefa Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Fri, 25 Jan 2019 11:06:19 -0600 Subject: [PATCH 06/11] wildcard_match_arm: add lint properly. --- CHANGELOG.md | 1 + README.md | 2 +- clippy_lints/src/lib.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b773422b0150..003ecba56102 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1027,6 +1027,7 @@ All notable changes to this project will be documented in this file. [`while_let_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop [`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator [`wildcard_dependencies`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies +[`wildcard_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_match_arm [`write_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_literal [`write_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline [`writeln_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#writeln_empty_string diff --git a/README.md b/README.md index 6473b8efc548..dad18ef75690 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code. -[There are 292 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html) +[There are 293 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html) We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you: diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 4683d353ccf8..a8ad74ce0c4a 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -495,6 +495,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { indexing_slicing::INDEXING_SLICING, inherent_impl::MULTIPLE_INHERENT_IMPL, literal_representation::DECIMAL_LITERAL_REPRESENTATION, + matches::WILDCARD_MATCH_ARM, mem_forget::MEM_FORGET, methods::CLONE_ON_REF_PTR, methods::OPTION_UNWRAP_USED, From ab5fe9a6d429d71f4738ace82a9eb9b5b3b9f7fe Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Sun, 27 Jan 2019 15:41:22 -0600 Subject: [PATCH 07/11] wilcard_match_arm: run rustfmt. --- clippy_lints/src/matches.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 024c88b368c5..0245b5a1362e 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -197,7 +197,7 @@ declare_clippy_lint! { /// ```rust /// match x { /// A => {}, -/// _ => {} +/// _ => {}, /// } /// ``` declare_clippy_lint! { @@ -466,12 +466,14 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { fn check_wild_match(cx: &LateContext<'_, '_>, arms: &[Arm]) { for arm in arms { if is_wild(&arm.pats[0]) { - span_note_and_lint(cx, + span_note_and_lint( + cx, WILDCARD_MATCH_ARM, arm.pats[0].span, "wildcard match will miss any future added variants.", arm.pats[0].span, - "to resolve, match each variant explicitly"); + "to resolve, match each variant explicitly", + ); } } } From 5ded6cd29c79fd7fa805f7677a5dd8c88d5c1507 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Tue, 29 Jan 2019 12:23:11 -0600 Subject: [PATCH 08/11] wildcard_match_arm: format test. --- tests/ui/wildcard_match_arm.rs | 52 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/ui/wildcard_match_arm.rs b/tests/ui/wildcard_match_arm.rs index 26a37c969a39..5d3a5ff2a751 100644 --- a/tests/ui/wildcard_match_arm.rs +++ b/tests/ui/wildcard_match_arm.rs @@ -2,35 +2,35 @@ #[derive(Clone, Copy, Debug, Eq, PartialEq)] enum Color { - Red, - Green, - Blue, - Rgb(u8, u8, u8), - Cyan, + Red, + Green, + Blue, + Rgb(u8, u8, u8), + Cyan, } impl Color { - fn is_monochrome(self) -> bool { - match self { - Color::Red | Color::Green | Color::Blue => true, - Color::Rgb(r, g, b) => r | g == 0 || r | b == 0 || g | b == 0, - Color::Cyan => false, - } - } + fn is_monochrome(self) -> bool { + match self { + Color::Red | Color::Green | Color::Blue => true, + Color::Rgb(r, g, b) => r | g == 0 || r | b == 0 || g | b == 0, + Color::Cyan => false, + } + } } fn main() { - let color = Color::Rgb(0, 0, 127); - match color { - Color::Red => println!("Red"), - _ => eprintln!("Not red"), - }; - match color { - Color::Red => {}, - Color::Green => {}, - Color::Blue => {}, - Color::Cyan => {}, - c if c.is_monochrome() => {}, - Color::Rgb(_, _, _) => {}, - }; -} \ No newline at end of file + let color = Color::Rgb(0, 0, 127); + match color { + Color::Red => println!("Red"), + _ => eprintln!("Not red"), + }; + match color { + Color::Red => {}, + Color::Green => {}, + Color::Blue => {}, + Color::Cyan => {}, + c if c.is_monochrome() => {}, + Color::Rgb(_, _, _) => {}, + }; +} From f56e013e2030d9eb35093b487e2ce94e2aa4b0bb Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Tue, 29 Jan 2019 12:39:01 -0600 Subject: [PATCH 09/11] wildcard_match_arm: update ui test stderr --- tests/ui/wildcard_match_arm.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/wildcard_match_arm.stderr b/tests/ui/wildcard_match_arm.stderr index 0d10382dc158..b78a82f60b5f 100644 --- a/tests/ui/wildcard_match_arm.stderr +++ b/tests/ui/wildcard_match_arm.stderr @@ -1,5 +1,5 @@ error: wildcard match will miss any future added variants. - --> $DIR/wildcard_match_arm.rs:26:3 + --> $DIR/wildcard_match_arm.rs:26:9 | LL | _ => eprintln!("Not red"), | ^ From 16d2ba46f4a51f2635192b32970b0ac064f22145 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Tue, 29 Jan 2019 14:25:40 -0600 Subject: [PATCH 10/11] wildcard_match_arm: lint only enum matches. --- CHANGELOG.md | 2 +- clippy_lints/src/lib.rs | 2 +- clippy_lints/src/matches.rs | 36 ++++++++++--------- ...atch_arm.rs => wildcard_enum_match_arm.rs} | 8 ++++- ....stderr => wildcard_enum_match_arm.stderr} | 8 ++--- 5 files changed, 32 insertions(+), 24 deletions(-) rename tests/ui/{wildcard_match_arm.rs => wildcard_enum_match_arm.rs} (83%) rename tests/ui/{wildcard_match_arm.stderr => wildcard_enum_match_arm.stderr} (58%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 003ecba56102..d7a6365f9677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1027,7 +1027,7 @@ All notable changes to this project will be documented in this file. [`while_let_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop [`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator [`wildcard_dependencies`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_dependencies -[`wildcard_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_match_arm +[`wildcard_enum_match_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_enum_match_arm [`write_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_literal [`write_with_newline`]: https://rust-lang.github.io/rust-clippy/master/index.html#write_with_newline [`writeln_empty_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#writeln_empty_string diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index a8ad74ce0c4a..5261a8f6322b 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -495,7 +495,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) { indexing_slicing::INDEXING_SLICING, inherent_impl::MULTIPLE_INHERENT_IMPL, literal_representation::DECIMAL_LITERAL_REPRESENTATION, - matches::WILDCARD_MATCH_ARM, + matches::WILDCARD_ENUM_MATCH_ARM, mem_forget::MEM_FORGET, methods::CLONE_ON_REF_PTR, methods::OPTION_UNWRAP_USED, diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 0245b5a1362e..e0094b19998a 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -187,9 +187,9 @@ declare_clippy_lint! { "a match on an Option value instead of using `as_ref()` or `as_mut`" } -/// **What it does:** Checks for wildcard matches using `_`. +/// **What it does:** Checks for wildcard enum matches using `_`. /// -/// **Why is this bad?** New variants added by library updates can be missed. +/// **Why is this bad?** New enum variants added by library updates can be missed. /// /// **Known problems:** None. /// @@ -201,9 +201,9 @@ declare_clippy_lint! { /// } /// ``` declare_clippy_lint! { - pub WILDCARD_MATCH_ARM, + pub WILDCARD_ENUM_MATCH_ARM, restriction, - "a wildcard match arm using `_`" + "a wildcard enum match arm using `_`" } #[allow(missing_copy_implementations)] @@ -219,7 +219,7 @@ impl LintPass for MatchPass { MATCH_OVERLAPPING_ARM, MATCH_WILD_ERR_ARM, MATCH_AS_REF, - WILDCARD_MATCH_ARM + WILDCARD_ENUM_MATCH_ARM ) } @@ -238,7 +238,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { check_match_bool(cx, ex, arms, expr); check_overlapping_arms(cx, ex, arms); check_wild_err_arm(cx, ex, arms); - check_wild_match(cx, arms); + check_wild_enum_match(cx, ex, arms); check_match_as_ref(cx, ex, arms, expr); } if let ExprKind::Match(ref ex, ref arms, _) = expr.node { @@ -463,17 +463,19 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { } } -fn check_wild_match(cx: &LateContext<'_, '_>, arms: &[Arm]) { - for arm in arms { - if is_wild(&arm.pats[0]) { - span_note_and_lint( - cx, - WILDCARD_MATCH_ARM, - arm.pats[0].span, - "wildcard match will miss any future added variants.", - arm.pats[0].span, - "to resolve, match each variant explicitly", - ); +fn check_wild_enum_match(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm]) { + if cx.tables.expr_ty(ex).is_enum() { + for arm in arms { + if is_wild(&arm.pats[0]) { + span_note_and_lint( + cx, + WILDCARD_ENUM_MATCH_ARM, + arm.pats[0].span, + "wildcard match will miss any future added variants.", + arm.pats[0].span, + "to resolve, match each variant explicitly", + ); + } } } } diff --git a/tests/ui/wildcard_match_arm.rs b/tests/ui/wildcard_enum_match_arm.rs similarity index 83% rename from tests/ui/wildcard_match_arm.rs rename to tests/ui/wildcard_enum_match_arm.rs index 5d3a5ff2a751..58daabf42686 100644 --- a/tests/ui/wildcard_match_arm.rs +++ b/tests/ui/wildcard_enum_match_arm.rs @@ -1,4 +1,4 @@ -#![deny(clippy::wildcard_match_arm)] +#![deny(clippy::wildcard_enum_match_arm)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] enum Color { @@ -33,4 +33,10 @@ fn main() { c if c.is_monochrome() => {}, Color::Rgb(_, _, _) => {}, }; + let x: u8 = unimplemented!(); + match x { + 0 => {}, + 140 => {}, + _ => {}, + }; } diff --git a/tests/ui/wildcard_match_arm.stderr b/tests/ui/wildcard_enum_match_arm.stderr similarity index 58% rename from tests/ui/wildcard_match_arm.stderr rename to tests/ui/wildcard_enum_match_arm.stderr index b78a82f60b5f..6319a3f3d46c 100644 --- a/tests/ui/wildcard_match_arm.stderr +++ b/tests/ui/wildcard_enum_match_arm.stderr @@ -1,14 +1,14 @@ error: wildcard match will miss any future added variants. - --> $DIR/wildcard_match_arm.rs:26:9 + --> $DIR/wildcard_enum_match_arm.rs:26:9 | LL | _ => eprintln!("Not red"), | ^ | note: lint level defined here - --> $DIR/wildcard_match_arm.rs:1:9 + --> $DIR/wildcard_enum_match_arm.rs:1:9 | -LL | #![deny(clippy::wildcard_match_arm)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![deny(clippy::wildcard_enum_match_arm)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: to resolve, match each variant explicitly error: aborting due to previous error From 97c7d2818aad2a9a400ca954e3db61a4c3d5d781 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Tue, 29 Jan 2019 14:34:04 -0600 Subject: [PATCH 11/11] wildcard_match_arm: add nesting issue to known. --- clippy_lints/src/matches.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index e0094b19998a..6ef073166910 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -191,7 +191,7 @@ declare_clippy_lint! { /// /// **Why is this bad?** New enum variants added by library updates can be missed. /// -/// **Known problems:** None. +/// **Known problems:** Nested wildcards a la `Foo(_)` are currently not detected. /// /// **Example:** /// ```rust