File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -13,21 +13,31 @@ use std::borrow::Cow;
13
13
14
14
declare_clippy_lint ! {
15
15
/// ### What it does
16
+ /// Checks for unnecessary guards in match expressions.
16
17
///
17
18
/// ### Why is this bad?
19
+ /// It's more complex and much less readable.
18
20
///
19
21
/// ### 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
+ /// }
22
28
/// ```
23
29
/// 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
+ /// }
26
36
/// ```
27
37
#[ clippy:: version = "1.72.0" ]
28
38
pub REDUNDANT_GUARD ,
29
- nursery ,
30
- "default lint descriptiona "
39
+ complexity ,
40
+ "checks for unnecessary guards in match expressions "
31
41
}
32
42
declare_lint_pass ! ( RedundantGuard => [ REDUNDANT_GUARD ] ) ;
33
43
You can’t perform that action at this time.
0 commit comments