mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 10:33:27 +00:00
43 lines
1.3 KiB
Text
43 lines
1.3 KiB
Text
|
error: match expression looks like `matches!` macro
|
||
|
--> $DIR/match_expr_like_matches_macro.rs:9:14
|
||
|
|
|
||
|
LL | let _y = match x {
|
||
|
| ______________^
|
||
|
LL | | Some(0) => true,
|
||
|
LL | | _ => false,
|
||
|
LL | | };
|
||
|
| |_____^ help: try this: `matches!(x, Some(0))`
|
||
|
|
|
||
|
= note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
|
||
|
|
||
|
error: redundant pattern matching, consider using `is_none()`
|
||
|
--> $DIR/match_expr_like_matches_macro.rs:15:14
|
||
|
|
|
||
|
LL | let _z = match x {
|
||
|
| ______________^
|
||
|
LL | | Some(_) => false,
|
||
|
LL | | None => true,
|
||
|
LL | | };
|
||
|
| |_____^ help: try this: `x.is_none()`
|
||
|
|
|
||
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
||
|
|
||
|
error: match expression looks like `matches!` macro
|
||
|
--> $DIR/match_expr_like_matches_macro.rs:21:14
|
||
|
|
|
||
|
LL | let _z = match x {
|
||
|
| ______________^
|
||
|
LL | | Some(r) if r == 0 => false,
|
||
|
LL | | _ => true,
|
||
|
LL | | };
|
||
|
| |_____^ help: try this: `!matches!(x, Some(r) if r == 0)`
|
||
|
|
||
|
error: if let .. else expression looks like `matches!` macro
|
||
|
--> $DIR/match_expr_like_matches_macro.rs:27:15
|
||
|
|
|
||
|
LL | let _zz = if let Some(5) = x { true } else { false };
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `matches!(x, Some(5))`
|
||
|
|
||
|
error: aborting due to 4 previous errors
|
||
|
|