Skip to content

Commit 67e6227

Browse files
committed
Update redundant_guard.rs
Update redundant_guard.rs
1 parent 83ce827 commit 67e6227

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

clippy_lints/src/redundant_guard.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,31 @@ use std::borrow::Cow;
1313

1414
declare_clippy_lint! {
1515
/// ### What it does
16+
/// Checks for unnecessary guards in match expressions.
1617
///
1718
/// ### Why is this bad?
19+
/// It's more complex and much less readable.
1820
///
1921
/// ### Example
20-
/// ```rust
21-
/// // example code where clippy issues a warning
22+
/// ```rust,ignore
23+
/// match x {
24+
/// Some(x) if matches!(x, Some(1)) => ..,
25+
/// Some(x) if x == Some(2) => ..,
26+
/// _ => todo!(),
27+
/// }
2228
/// ```
2329
/// Use instead:
24-
/// ```rust
25-
/// // example code which does not raise clippy warning
30+
/// ```rust,ignore
31+
/// match x {
32+
/// Some(Some(1)) => ..,
33+
/// Some(Some(2)) => ..,
34+
/// _ => todo!(),
35+
/// }
2636
/// ```
2737
#[clippy::version = "1.72.0"]
2838
pub REDUNDANT_GUARD,
29-
nursery,
30-
"default lint descriptiona"
39+
complexity,
40+
"checks for unnecessary guards in match expressions"
3141
}
3242
declare_lint_pass!(RedundantGuard => [REDUNDANT_GUARD]);
3343

0 commit comments

Comments
 (0)