@@ -21,6 +21,7 @@ struct Foo {
21
21
#[ deny( match_same_arms) ]
22
22
fn if_same_then_else ( ) -> Result < & ' static str , ( ) > {
23
23
if true {
24
+ //~^NOTE same as this
24
25
Foo { bar : 42 } ;
25
26
0 ..10 ;
26
27
..;
@@ -62,6 +63,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
62
63
}
63
64
64
65
let _ = if true {
66
+ //~^NOTE same as this
65
67
foo ( ) ;
66
68
42
67
69
}
@@ -75,13 +77,15 @@ fn if_same_then_else() -> Result<&'static str, ()> {
75
77
}
76
78
77
79
let _ = if true {
80
+ //~^NOTE same as this
78
81
42
79
82
}
80
83
else { //~ERROR this `if` has identical blocks
81
84
42
82
85
} ;
83
86
84
87
if true {
88
+ //~^NOTE same as this
85
89
let bar = if true {
86
90
42
87
91
}
@@ -105,6 +109,7 @@ fn if_same_then_else() -> Result<&'static str, ()> {
105
109
}
106
110
107
111
if true {
112
+ //~^NOTE same as this
108
113
let _ = match 42 {
109
114
42 => 1 ,
110
115
a if a > 0 => 2 ,
@@ -125,13 +130,15 @@ fn if_same_then_else() -> Result<&'static str, ()> {
125
130
}
126
131
127
132
if true {
133
+ //~^NOTE same as this
128
134
if let Some ( a) = Some ( 42 ) { }
129
135
}
130
136
else { //~ERROR this `if` has identical blocks
131
137
if let Some ( a) = Some ( 42 ) { }
132
138
}
133
139
134
140
if true {
141
+ //~^NOTE same as this
135
142
if let ( 1 , .., 3 ) = ( 1 , 2 , 3 ) { }
136
143
}
137
144
else { //~ERROR this `if` has identical blocks
@@ -168,12 +175,16 @@ fn if_same_then_else() -> Result<&'static str, ()> {
168
175
169
176
let _ = match 42 {
170
177
42 => foo ( ) ,
178
+ //~^NOTE same as this
179
+ //~|NOTE `42 | 51`
171
180
51 => foo ( ) , //~ERROR this `match` has identical arm bodies
172
181
_ => true ,
173
182
} ;
174
183
175
184
let _ = match Some ( 42 ) {
176
185
Some ( _) => 24 ,
186
+ //~^NOTE same as this
187
+ //~|NOTE `Some(_) | None`
177
188
None => 24 , //~ERROR this `match` has identical arm bodies
178
189
} ;
179
190
@@ -196,18 +207,24 @@ fn if_same_then_else() -> Result<&'static str, ()> {
196
207
197
208
match ( Some ( 42 ) , Some ( 42 ) ) {
198
209
( Some ( a) , None ) => bar ( a) ,
210
+ //~^NOTE same as this
211
+ //~|NOTE `(Some(a), None) | (None, Some(a))`
199
212
( None , Some ( a) ) => bar ( a) , //~ERROR this `match` has identical arm bodies
200
213
_ => ( ) ,
201
214
}
202
215
203
216
match ( Some ( 42 ) , Some ( 42 ) ) {
204
217
( Some ( a) , ..) => bar ( a) ,
218
+ //~^NOTE same as this
219
+ //~|NOTE `(Some(a), ..) | (.., Some(a))`
205
220
( .., Some ( a) ) => bar ( a) , //~ERROR this `match` has identical arm bodies
206
221
_ => ( ) ,
207
222
}
208
223
209
224
match ( 1 , 2 , 3 ) {
210
225
( 1 , .., 3 ) => 42 ,
226
+ //~^NOTE same as this
227
+ //~|NOTE `(1, .., 3) | (.., 3)`
211
228
( .., 3 ) => 42 , //~ERROR this `match` has identical arm bodies
212
229
_ => 0 ,
213
230
} ;
@@ -219,13 +236,15 @@ fn if_same_then_else() -> Result<&'static str, ()> {
219
236
}
220
237
221
238
if true {
239
+ //~^NOTE same as this
222
240
try!( Ok ( "foo" ) ) ;
223
241
}
224
242
else { //~ERROR this `if` has identical blocks
225
243
try!( Ok ( "foo" ) ) ;
226
244
}
227
245
228
246
if true {
247
+ //~^NOTE same as this
229
248
let foo = "" ;
230
249
return Ok ( & foo[ 0 ..] ) ;
231
250
}
@@ -246,16 +265,19 @@ fn ifs_same_cond() {
246
265
let b = false ;
247
266
248
267
if b {
268
+ //~^NOTE same as this
249
269
}
250
270
else if b { //~ERROR this `if` has the same condition as a previous if
251
271
}
252
272
253
273
if a == 1 {
274
+ //~^NOTE same as this
254
275
}
255
276
else if a == 1 { //~ERROR this `if` has the same condition as a previous if
256
277
}
257
278
258
279
if 2 * a == 1 {
280
+ //~^NOTE same as this
259
281
}
260
282
else if 2 * a == 2 {
261
283
}
0 commit comments