Skip to content

Commit fdcbd71

Browse files
committed
minor test cleanup
- Removes some excess parens - Removes 3 duplicated tests
1 parent 3f9b198 commit fdcbd71

File tree

4 files changed

+26
-59
lines changed

4 files changed

+26
-59
lines changed

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,7 @@ LL | if let Some(&Some(x)) = &Some(Some(0)) {
7171
| ~
7272

7373
error[E0308]: mismatched types
74-
--> $DIR/pattern-errors.rs:38:17
75-
|
76-
LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
77-
| ^^^^^
78-
|
79-
= note: cannot match inherited `&` with `&mut` pattern
80-
help: replace this `&mut` pattern with `&`
81-
|
82-
LL | if let Some(&Some(x)) = &Some(Some(0)) {
83-
| ~
84-
85-
error[E0308]: mismatched types
86-
--> $DIR/pattern-errors.rs:118:10
74+
--> $DIR/pattern-errors.rs:115:10
8775
|
8876
LL | let [&mut x] = &[&mut 0];
8977
| ^^^^^
@@ -95,7 +83,7 @@ LL | let [&x] = &[&mut 0];
9583
| ~
9684

9785
error[E0308]: mismatched types
98-
--> $DIR/pattern-errors.rs:123:10
86+
--> $DIR/pattern-errors.rs:120:10
9987
|
10088
LL | let [&mut &x] = &[&mut 0];
10189
| ^^^^^
@@ -107,7 +95,7 @@ LL | let [&&x] = &[&mut 0];
10795
| ~
10896

10997
error[E0308]: mismatched types
110-
--> $DIR/pattern-errors.rs:128:10
98+
--> $DIR/pattern-errors.rs:125:10
11199
|
112100
LL | let [&mut &ref x] = &[&mut 0];
113101
| ^^^^^
@@ -119,7 +107,7 @@ LL | let [&&ref x] = &[&mut 0];
119107
| ~
120108

121109
error[E0308]: mismatched types
122-
--> $DIR/pattern-errors.rs:133:10
110+
--> $DIR/pattern-errors.rs:130:10
123111
|
124112
LL | let [&mut &(mut x)] = &[&mut 0];
125113
| ^^^^^
@@ -130,6 +118,6 @@ help: replace this `&mut` pattern with `&`
130118
LL | let [&&(mut x)] = &[&mut 0];
131119
| ~
132120

133-
error: aborting due to 11 previous errors
121+
error: aborting due to 10 previous errors
134122

135123
For more information about this error, try `rustc --explain E0308`.

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@ pub fn main() {
2929
if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
3030
//~^ ERROR: mismatched types
3131
}
32-
if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
32+
if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) {
3333
//[structural2024]~^ ERROR: mismatched types
3434
}
3535
if let Some(&mut Some(x)) = &Some(Some(0)) {
3636
//~^ ERROR: mismatched types
3737
}
38-
if let Some(&mut Some(x)) = &Some(Some(0)) {
39-
//~^ ERROR: mismatched types
40-
}
4138
}
4239

4340
fn structural_errors_0() {

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) {
3535
| ~
3636

3737
error[E0308]: mismatched types
38-
--> $DIR/pattern-errors.rs:32:29
38+
--> $DIR/pattern-errors.rs:32:28
3939
|
40-
LL | if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
41-
| ^^^^^
40+
LL | if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) {
41+
| ^^^^^
4242
|
4343
= note: cannot match inherited `&` with `&mut` pattern
4444
help: replace this `&mut` pattern with `&`
4545
|
46-
LL | if let Some(&Some(Some((&_)))) = &Some(Some(&mut Some(0))) {
47-
| ~
46+
LL | if let Some(&Some(Some(&_))) = &Some(Some(&mut Some(0))) {
47+
| ~
4848

4949
error[E0308]: mismatched types
5050
--> $DIR/pattern-errors.rs:35:17
@@ -59,19 +59,7 @@ LL | if let Some(&Some(x)) = &Some(Some(0)) {
5959
| ~
6060

6161
error[E0308]: mismatched types
62-
--> $DIR/pattern-errors.rs:38:17
63-
|
64-
LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
65-
| ^^^^^
66-
|
67-
= note: cannot match inherited `&` with `&mut` pattern
68-
help: replace this `&mut` pattern with `&`
69-
|
70-
LL | if let Some(&Some(x)) = &Some(Some(0)) {
71-
| ~
72-
73-
error[E0308]: mismatched types
74-
--> $DIR/pattern-errors.rs:44:11
62+
--> $DIR/pattern-errors.rs:41:11
7563
|
7664
LL | let &[&mut x] = &&mut [0];
7765
| ^^^^^
@@ -83,7 +71,7 @@ LL | let &[&x] = &&mut [0];
8371
| ~
8472

8573
error[E0308]: mismatched types
86-
--> $DIR/pattern-errors.rs:49:11
74+
--> $DIR/pattern-errors.rs:46:11
8775
|
8876
LL | let &[&mut x] = &mut &mut [0];
8977
| ^^^^^
@@ -95,7 +83,7 @@ LL | let &[&x] = &mut &mut [0];
9583
| ~
9684

9785
error[E0308]: mismatched types
98-
--> $DIR/pattern-errors.rs:54:11
86+
--> $DIR/pattern-errors.rs:51:11
9987
|
10088
LL | let &[&mut ref x] = &&mut [0];
10189
| ^^^^^
@@ -107,7 +95,7 @@ LL | let &[&ref x] = &&mut [0];
10795
| ~
10896

10997
error[E0308]: mismatched types
110-
--> $DIR/pattern-errors.rs:59:11
98+
--> $DIR/pattern-errors.rs:56:11
11199
|
112100
LL | let &[&mut ref x] = &mut &mut [0];
113101
| ^^^^^
@@ -119,7 +107,7 @@ LL | let &[&ref x] = &mut &mut [0];
119107
| ~
120108

121109
error[E0308]: mismatched types
122-
--> $DIR/pattern-errors.rs:64:11
110+
--> $DIR/pattern-errors.rs:61:11
123111
|
124112
LL | let &[&mut mut x] = &&mut [0];
125113
| ^^^^^
@@ -131,7 +119,7 @@ LL | let &[&mut x] = &&mut [0];
131119
| ~
132120

133121
error[E0308]: mismatched types
134-
--> $DIR/pattern-errors.rs:69:11
122+
--> $DIR/pattern-errors.rs:66:11
135123
|
136124
LL | let &[&mut mut x] = &mut &mut [0];
137125
| ^^^^^
@@ -143,7 +131,7 @@ LL | let &[&mut x] = &mut &mut [0];
143131
| ~
144132

145133
error[E0658]: binding cannot be both mutable and by-reference
146-
--> $DIR/pattern-errors.rs:76:12
134+
--> $DIR/pattern-errors.rs:73:12
147135
|
148136
LL | let [&(mut x)] = &[&0];
149137
| ^^^^
@@ -153,7 +141,7 @@ LL | let [&(mut x)] = &[&0];
153141
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
154142

155143
error[E0658]: binding cannot be both mutable and by-reference
156-
--> $DIR/pattern-errors.rs:80:12
144+
--> $DIR/pattern-errors.rs:77:12
157145
|
158146
LL | let [&(mut x)] = &mut [&0];
159147
| ^^^^
@@ -163,7 +151,7 @@ LL | let [&(mut x)] = &mut [&0];
163151
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
164152

165153
error[E0308]: mismatched types
166-
--> $DIR/pattern-errors.rs:86:11
154+
--> $DIR/pattern-errors.rs:83:11
167155
|
168156
LL | let [&&mut x] = &[&mut 0];
169157
| ^^^^^
@@ -175,7 +163,7 @@ LL | let [&&x] = &[&mut 0];
175163
| ~
176164

177165
error[E0308]: mismatched types
178-
--> $DIR/pattern-errors.rs:91:11
166+
--> $DIR/pattern-errors.rs:88:11
179167
|
180168
LL | let [&&mut x] = &mut [&mut 0];
181169
| ^^^^^
@@ -187,7 +175,7 @@ LL | let [&&x] = &mut [&mut 0];
187175
| ~
188176

189177
error[E0308]: mismatched types
190-
--> $DIR/pattern-errors.rs:96:11
178+
--> $DIR/pattern-errors.rs:93:11
191179
|
192180
LL | let [&&mut ref x] = &[&mut 0];
193181
| ^^^^^
@@ -199,7 +187,7 @@ LL | let [&&ref x] = &[&mut 0];
199187
| ~
200188

201189
error[E0308]: mismatched types
202-
--> $DIR/pattern-errors.rs:101:11
190+
--> $DIR/pattern-errors.rs:98:11
203191
|
204192
LL | let [&&mut ref x] = &mut [&mut 0];
205193
| ^^^^^
@@ -211,7 +199,7 @@ LL | let [&&ref x] = &mut [&mut 0];
211199
| ~
212200

213201
error[E0308]: mismatched types
214-
--> $DIR/pattern-errors.rs:106:11
202+
--> $DIR/pattern-errors.rs:103:11
215203
|
216204
LL | let [&&mut mut x] = &[&mut 0];
217205
| ^^^^^
@@ -223,7 +211,7 @@ LL | let [&&mut x] = &[&mut 0];
223211
| ~
224212

225213
error[E0308]: mismatched types
226-
--> $DIR/pattern-errors.rs:111:11
214+
--> $DIR/pattern-errors.rs:108:11
227215
|
228216
LL | let [&&mut mut x] = &mut [&mut 0];
229217
| ^^^^^
@@ -234,7 +222,7 @@ help: replace this `&mut` pattern with `&`
234222
LL | let [&&mut x] = &mut [&mut 0];
235223
| ~
236224

237-
error: aborting due to 20 previous errors
225+
error: aborting due to 19 previous errors
238226

239227
Some errors have detailed explanations: E0308, E0658.
240228
For more information about an error, try `rustc --explain E0308`.

tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ pub fn main() {
2323
if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) {
2424
let _: u32 = x;
2525
}
26-
if let Some(Some(&x)) = &Some(&Some(0)) {
27-
let _: u32 = x;
28-
}
2926
if let Some(&Some(&x)) = &mut Some(&Some(0)) {
3027
let _: u32 = x;
3128
}
@@ -41,9 +38,6 @@ pub fn main() {
4138
if let Some(&Some(&x)) = &Some(&Some(0)) {
4239
let _: u32 = x;
4340
}
44-
if let Some(&Some(&x)) = &Some(&mut Some(0)) {
45-
let _: u32 = x;
46-
}
4741
if let Some(&Some(Some(&x))) = &Some(Some(&mut Some(0))) {
4842
let _: u32 = x;
4943
}

0 commit comments

Comments
 (0)