Skip to content

Commit 3c5ee33

Browse files
Update tests
1 parent 81810fa commit 3c5ee33

6 files changed

+34
-42
lines changed

tests/ui/redundant_pattern_matching.fixed

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-rustfix
22

3-
#![feature(const_if_match)]
4-
#![feature(const_loop)]
53
#![warn(clippy::all)]
64
#![warn(clippy::redundant_pattern_matching)]
75
#![allow(clippy::unit_arg, unused_must_use, clippy::needless_bool, deprecated)]

tests/ui/redundant_pattern_matching.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-rustfix
22

3-
#![feature(const_if_match)]
4-
#![feature(const_loop)]
53
#![warn(clippy::all)]
64
#![warn(clippy::redundant_pattern_matching)]
75
#![allow(clippy::unit_arg, unused_must_use, clippy::needless_bool, deprecated)]

tests/ui/redundant_pattern_matching.stderr

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
error: redundant pattern matching, consider using `is_ok()`
2-
--> $DIR/redundant_pattern_matching.rs:10:12
2+
--> $DIR/redundant_pattern_matching.rs:8:12
33
|
44
LL | if let Ok(_) = Ok::<i32, i32>(42) {}
55
| -------^^^^^--------------------- help: try this: `if Ok::<i32, i32>(42).is_ok()`
66
|
77
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
88

99
error: redundant pattern matching, consider using `is_err()`
10-
--> $DIR/redundant_pattern_matching.rs:12:12
10+
--> $DIR/redundant_pattern_matching.rs:10:12
1111
|
1212
LL | if let Err(_) = Err::<i32, i32>(42) {}
1313
| -------^^^^^^---------------------- help: try this: `if Err::<i32, i32>(42).is_err()`
1414

1515
error: redundant pattern matching, consider using `is_none()`
16-
--> $DIR/redundant_pattern_matching.rs:14:12
16+
--> $DIR/redundant_pattern_matching.rs:12:12
1717
|
1818
LL | if let None = None::<()> {}
1919
| -------^^^^------------- help: try this: `if None::<()>.is_none()`
2020

2121
error: redundant pattern matching, consider using `is_some()`
22-
--> $DIR/redundant_pattern_matching.rs:16:12
22+
--> $DIR/redundant_pattern_matching.rs:14:12
2323
|
2424
LL | if let Some(_) = Some(42) {}
2525
| -------^^^^^^^----------- help: try this: `if Some(42).is_some()`
2626

2727
error: redundant pattern matching, consider using `is_some()`
28-
--> $DIR/redundant_pattern_matching.rs:18:12
28+
--> $DIR/redundant_pattern_matching.rs:16:12
2929
|
3030
LL | if let Some(_) = Some(42) {
3131
| -------^^^^^^^----------- help: try this: `if Some(42).is_some()`
3232

3333
error: redundant pattern matching, consider using `is_some()`
34-
--> $DIR/redundant_pattern_matching.rs:24:15
34+
--> $DIR/redundant_pattern_matching.rs:22:15
3535
|
3636
LL | while let Some(_) = Some(42) {}
3737
| ----------^^^^^^^----------- help: try this: `while Some(42).is_some()`
3838

3939
error: redundant pattern matching, consider using `is_none()`
40-
--> $DIR/redundant_pattern_matching.rs:26:15
40+
--> $DIR/redundant_pattern_matching.rs:24:15
4141
|
4242
LL | while let None = Some(42) {}
4343
| ----------^^^^----------- help: try this: `while Some(42).is_none()`
4444

4545
error: redundant pattern matching, consider using `is_none()`
46-
--> $DIR/redundant_pattern_matching.rs:28:15
46+
--> $DIR/redundant_pattern_matching.rs:26:15
4747
|
4848
LL | while let None = None::<()> {}
4949
| ----------^^^^------------- help: try this: `while None::<()>.is_none()`
5050

5151
error: redundant pattern matching, consider using `is_ok()`
52-
--> $DIR/redundant_pattern_matching.rs:30:15
52+
--> $DIR/redundant_pattern_matching.rs:28:15
5353
|
5454
LL | while let Ok(_) = Ok::<i32, i32>(10) {}
5555
| ----------^^^^^--------------------- help: try this: `while Ok::<i32, i32>(10).is_ok()`
5656

5757
error: redundant pattern matching, consider using `is_err()`
58-
--> $DIR/redundant_pattern_matching.rs:32:15
58+
--> $DIR/redundant_pattern_matching.rs:30:15
5959
|
6060
LL | while let Err(_) = Ok::<i32, i32>(10) {}
6161
| ----------^^^^^^--------------------- help: try this: `while Ok::<i32, i32>(10).is_err()`
6262

6363
error: redundant pattern matching, consider using `is_some()`
64-
--> $DIR/redundant_pattern_matching.rs:35:15
64+
--> $DIR/redundant_pattern_matching.rs:33:15
6565
|
6666
LL | while let Some(_) = v.pop() {
6767
| ----------^^^^^^^---------- help: try this: `while v.pop().is_some()`
6868

6969
error: redundant pattern matching, consider using `is_ok()`
70-
--> $DIR/redundant_pattern_matching.rs:51:5
70+
--> $DIR/redundant_pattern_matching.rs:49:5
7171
|
7272
LL | / match Ok::<i32, i32>(42) {
7373
LL | | Ok(_) => true,
@@ -76,7 +76,7 @@ LL | | };
7676
| |_____^ help: try this: `Ok::<i32, i32>(42).is_ok()`
7777

7878
error: redundant pattern matching, consider using `is_err()`
79-
--> $DIR/redundant_pattern_matching.rs:56:5
79+
--> $DIR/redundant_pattern_matching.rs:54:5
8080
|
8181
LL | / match Ok::<i32, i32>(42) {
8282
LL | | Ok(_) => false,
@@ -85,7 +85,7 @@ LL | | };
8585
| |_____^ help: try this: `Ok::<i32, i32>(42).is_err()`
8686

8787
error: redundant pattern matching, consider using `is_err()`
88-
--> $DIR/redundant_pattern_matching.rs:61:5
88+
--> $DIR/redundant_pattern_matching.rs:59:5
8989
|
9090
LL | / match Err::<i32, i32>(42) {
9191
LL | | Ok(_) => false,
@@ -94,7 +94,7 @@ LL | | };
9494
| |_____^ help: try this: `Err::<i32, i32>(42).is_err()`
9595

9696
error: redundant pattern matching, consider using `is_ok()`
97-
--> $DIR/redundant_pattern_matching.rs:66:5
97+
--> $DIR/redundant_pattern_matching.rs:64:5
9898
|
9999
LL | / match Err::<i32, i32>(42) {
100100
LL | | Ok(_) => true,
@@ -103,7 +103,7 @@ LL | | };
103103
| |_____^ help: try this: `Err::<i32, i32>(42).is_ok()`
104104

105105
error: redundant pattern matching, consider using `is_some()`
106-
--> $DIR/redundant_pattern_matching.rs:71:5
106+
--> $DIR/redundant_pattern_matching.rs:69:5
107107
|
108108
LL | / match Some(42) {
109109
LL | | Some(_) => true,
@@ -112,7 +112,7 @@ LL | | };
112112
| |_____^ help: try this: `Some(42).is_some()`
113113

114114
error: redundant pattern matching, consider using `is_none()`
115-
--> $DIR/redundant_pattern_matching.rs:76:5
115+
--> $DIR/redundant_pattern_matching.rs:74:5
116116
|
117117
LL | / match None::<()> {
118118
LL | | Some(_) => false,
@@ -121,7 +121,7 @@ LL | | };
121121
| |_____^ help: try this: `None::<()>.is_none()`
122122

123123
error: redundant pattern matching, consider using `is_none()`
124-
--> $DIR/redundant_pattern_matching.rs:81:13
124+
--> $DIR/redundant_pattern_matching.rs:79:13
125125
|
126126
LL | let _ = match None::<()> {
127127
| _____________^
@@ -131,61 +131,61 @@ LL | | };
131131
| |_____^ help: try this: `None::<()>.is_none()`
132132

133133
error: redundant pattern matching, consider using `is_ok()`
134-
--> $DIR/redundant_pattern_matching.rs:86:20
134+
--> $DIR/redundant_pattern_matching.rs:84:20
135135
|
136136
LL | let _ = if let Ok(_) = Ok::<usize, ()>(4) { true } else { false };
137137
| -------^^^^^--------------------- help: try this: `if Ok::<usize, ()>(4).is_ok()`
138138

139139
error: redundant pattern matching, consider using `is_some()`
140-
--> $DIR/redundant_pattern_matching.rs:89:20
140+
--> $DIR/redundant_pattern_matching.rs:87:20
141141
|
142142
LL | let x = if let Some(_) = opt { true } else { false };
143143
| -------^^^^^^^------ help: try this: `if opt.is_some()`
144144

145145
error: redundant pattern matching, consider using `is_some()`
146-
--> $DIR/redundant_pattern_matching.rs:95:20
146+
--> $DIR/redundant_pattern_matching.rs:93:20
147147
|
148148
LL | let _ = if let Some(_) = gen_opt() {
149149
| -------^^^^^^^------------ help: try this: `if gen_opt().is_some()`
150150

151151
error: redundant pattern matching, consider using `is_none()`
152-
--> $DIR/redundant_pattern_matching.rs:97:19
152+
--> $DIR/redundant_pattern_matching.rs:95:19
153153
|
154154
LL | } else if let None = gen_opt() {
155155
| -------^^^^------------ help: try this: `if gen_opt().is_none()`
156156

157157
error: redundant pattern matching, consider using `is_ok()`
158-
--> $DIR/redundant_pattern_matching.rs:99:19
158+
--> $DIR/redundant_pattern_matching.rs:97:19
159159
|
160160
LL | } else if let Ok(_) = gen_res() {
161161
| -------^^^^^------------ help: try this: `if gen_res().is_ok()`
162162

163163
error: redundant pattern matching, consider using `is_err()`
164-
--> $DIR/redundant_pattern_matching.rs:101:19
164+
--> $DIR/redundant_pattern_matching.rs:99:19
165165
|
166166
LL | } else if let Err(_) = gen_res() {
167167
| -------^^^^^^------------ help: try this: `if gen_res().is_err()`
168168

169169
error: redundant pattern matching, consider using `is_some()`
170-
--> $DIR/redundant_pattern_matching.rs:134:19
170+
--> $DIR/redundant_pattern_matching.rs:132:19
171171
|
172172
LL | while let Some(_) = r#try!(result_opt()) {}
173173
| ----------^^^^^^^----------------------- help: try this: `while r#try!(result_opt()).is_some()`
174174

175175
error: redundant pattern matching, consider using `is_some()`
176-
--> $DIR/redundant_pattern_matching.rs:135:16
176+
--> $DIR/redundant_pattern_matching.rs:133:16
177177
|
178178
LL | if let Some(_) = r#try!(result_opt()) {}
179179
| -------^^^^^^^----------------------- help: try this: `if r#try!(result_opt()).is_some()`
180180

181181
error: redundant pattern matching, consider using `is_some()`
182-
--> $DIR/redundant_pattern_matching.rs:141:12
182+
--> $DIR/redundant_pattern_matching.rs:139:12
183183
|
184184
LL | if let Some(_) = m!() {}
185185
| -------^^^^^^^------- help: try this: `if m!().is_some()`
186186

187187
error: redundant pattern matching, consider using `is_some()`
188-
--> $DIR/redundant_pattern_matching.rs:142:15
188+
--> $DIR/redundant_pattern_matching.rs:140:15
189189
|
190190
LL | while let Some(_) = m!() {}
191191
| ----------^^^^^^^------- help: try this: `while m!().is_some()`

tests/ui/redundant_pattern_matching_const_result.fixed

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-rustfix
22

3-
#![feature(const_if_match)]
4-
#![feature(const_loop)]
53
#![feature(const_result)]
64
#![warn(clippy::redundant_pattern_matching)]
75
#![allow(unused)]

tests/ui/redundant_pattern_matching_const_result.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-rustfix
22

3-
#![feature(const_if_match)]
4-
#![feature(const_loop)]
53
#![feature(const_result)]
64
#![warn(clippy::redundant_pattern_matching)]
75
#![allow(unused)]

tests/ui/redundant_pattern_matching_const_result.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: redundant pattern matching, consider using `is_ok()`
2-
--> $DIR/redundant_pattern_matching_const_result.rs:12:12
2+
--> $DIR/redundant_pattern_matching_const_result.rs:10:12
33
|
44
LL | if let Ok(_) = Ok::<i32, i32>(42) {}
55
| -------^^^^^--------------------- help: try this: `if Ok::<i32, i32>(42).is_ok()`
66
|
77
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
88

99
error: redundant pattern matching, consider using `is_err()`
10-
--> $DIR/redundant_pattern_matching_const_result.rs:14:12
10+
--> $DIR/redundant_pattern_matching_const_result.rs:12:12
1111
|
1212
LL | if let Err(_) = Err::<i32, i32>(42) {}
1313
| -------^^^^^^---------------------- help: try this: `if Err::<i32, i32>(42).is_err()`
1414

1515
error: redundant pattern matching, consider using `is_ok()`
16-
--> $DIR/redundant_pattern_matching_const_result.rs:16:15
16+
--> $DIR/redundant_pattern_matching_const_result.rs:14:15
1717
|
1818
LL | while let Ok(_) = Ok::<i32, i32>(10) {}
1919
| ----------^^^^^--------------------- help: try this: `while Ok::<i32, i32>(10).is_ok()`
2020

2121
error: redundant pattern matching, consider using `is_err()`
22-
--> $DIR/redundant_pattern_matching_const_result.rs:18:15
22+
--> $DIR/redundant_pattern_matching_const_result.rs:16:15
2323
|
2424
LL | while let Err(_) = Ok::<i32, i32>(10) {}
2525
| ----------^^^^^^--------------------- help: try this: `while Ok::<i32, i32>(10).is_err()`
2626

2727
error: redundant pattern matching, consider using `is_ok()`
28-
--> $DIR/redundant_pattern_matching_const_result.rs:20:5
28+
--> $DIR/redundant_pattern_matching_const_result.rs:18:5
2929
|
3030
LL | / match Ok::<i32, i32>(42) {
3131
LL | | Ok(_) => true,
@@ -34,7 +34,7 @@ LL | | };
3434
| |_____^ help: try this: `Ok::<i32, i32>(42).is_ok()`
3535

3636
error: redundant pattern matching, consider using `is_err()`
37-
--> $DIR/redundant_pattern_matching_const_result.rs:25:5
37+
--> $DIR/redundant_pattern_matching_const_result.rs:23:5
3838
|
3939
LL | / match Err::<i32, i32>(42) {
4040
LL | | Ok(_) => false,

0 commit comments

Comments
 (0)