1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:14:14
|
LL | let _y = match x {
| ______________^
LL | | Some(0) => true,
LL | | _ => false,
LL | | };
| |_____^ help: try: `matches!(x, Some(0))`
|
= note: `-D clippy::match-like-matches-macro` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::match_like_matches_macro)]`
error: redundant pattern matching, consider using `is_some()`
--> tests/ui/match_expr_like_matches_macro.rs:21:14
|
LL | let _w = match x {
| ______________^
LL | | Some(_) => true,
LL | | _ => false,
LL | | };
| |_____^ help: try: `x.is_some()`
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
error: redundant pattern matching, consider using `is_none()`
--> tests/ui/match_expr_like_matches_macro.rs:28:14
|
LL | let _z = match x {
| ______________^
LL | | Some(_) => false,
LL | | None => true,
LL | | };
| |_____^ help: try: `x.is_none()`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:35:15
|
LL | let _zz = match x {
| _______________^
LL | | Some(r) if r == 0 => false,
LL | | _ => true,
LL | | };
| |_____^ help: try: `!matches!(x, Some(r) if r == 0)`
error: if let .. else expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:42:16
|
LL | let _zzz = if let Some(5) = x { true } else { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(x, Some(5))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:67:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::A(_) => true,
LL | | E::B(_) => true,
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(x, E::A(_) | E::B(_))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:78:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::A(_) => {
LL | | true
... |
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(x, E::A(_) | E::B(_))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:89:20
|
LL | let _ans = match x {
| ____________________^
LL | | E::B(_) => false,
LL | | E::C => false,
LL | | _ => true,
LL | | };
| |_________^ help: try: `!matches!(x, E::B(_) | E::C)`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:150:18
|
LL | let _z = match &z {
| __________________^
LL | | Some(3) => true,
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(z, Some(3))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:160:18
|
LL | let _z = match &z {
| __________________^
LL | | Some(3) => true,
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(&z, Some(3))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:178:21
|
LL | let _ = match &z {
| _____________________^
LL | | AnEnum::X => true,
LL | | _ => false,
LL | | };
| |_____________^ help: try: `matches!(&z, AnEnum::X)`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:193:20
|
LL | let _res = match &val {
| ____________________^
LL | | &Some(ref _a) => true,
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(&val, &Some(ref _a))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:206:20
|
LL | let _res = match &val {
| ____________________^
LL | | &Some(ref _a) => true,
LL | | _ => false,
LL | | };
| |_________^ help: try: `matches!(&val, &Some(ref _a))`
error: match expression looks like `matches!` macro
--> tests/ui/match_expr_like_matches_macro.rs:265:14
|
LL | let _y = match Some(5) {
| ______________^
LL | | Some(0) => true,
LL | | _ => false,
LL | | };
| |_____^ help: try: `matches!(Some(5), Some(0))`
error: aborting due to 14 previous errors
|