rust-clippy/tests/ui/match_expr_like_matches_macro.stderr

148 lines
4.5 KiB
Text
Raw Normal View History

error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:16:14
|
LL | let _y = match x {
| ______________^
LL | | Some(0) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `matches!(x, Some(0))`
|
= note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
2023-05-06 22:59:52 +00:00
error: redundant pattern matching, consider using `is_some()`
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:22:14
|
LL | let _w = match x {
| ______________^
LL | | Some(_) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `x.is_some()`
2023-05-06 22:59:52 +00:00
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
error: redundant pattern matching, consider using `is_none()`
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:28:14
|
LL | let _z = match x {
| ______________^
LL | | Some(_) => false,
LL | | None => true,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `x.is_none()`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:34:15
|
LL | let _zz = match x {
| _______________^
LL | | Some(r) if r == 0 => false,
LL | | _ => true,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `!matches!(x, Some(r) if r == 0)`
error: if let .. else expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:40:16
|
LL | let _zzz = if let Some(5) = x { true } else { false };
2023-07-01 11:08:01 +00:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(x, Some(5))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:64:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::A(_) => true,
LL | | E::B(_) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(x, E::A(_) | E::B(_))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:74:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::A(_) => {
LL | | true
LL | | }
LL | | E::B(_) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(x, E::A(_) | E::B(_))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:84:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::B(_) => false,
LL | | E::C => false,
LL | | _ => true,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `!matches!(x, E::B(_) | E::C)`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:144:18
|
LL | let _z = match &z {
| __________________^
LL | | Some(3) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(z, Some(3))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:153:18
|
LL | let _z = match &z {
| __________________^
LL | | Some(3) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(&z, Some(3))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:170:21
|
LL | let _ = match &z {
| _____________________^
LL | | AnEnum::X => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____________^ help: try: `matches!(&z, AnEnum::X)`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:184:20
|
LL | let _res = match &val {
| ____________________^
LL | | &Some(ref _a) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(&val, &Some(ref _a))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:196:20
|
LL | let _res = match &val {
| ____________________^
LL | | &Some(ref _a) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `matches!(&val, &Some(ref _a))`
error: match expression looks like `matches!` macro
2023-06-14 18:51:31 +00:00
--> $DIR/match_expr_like_matches_macro.rs:254:14
|
LL | let _y = match Some(5) {
| ______________^
LL | | Some(0) => true,
LL | | _ => false,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `matches!(Some(5), Some(0))`
error: aborting due to 14 previous errors