File tree Expand file tree Collapse file tree 2 files changed +42
-14
lines changed
rust/ql/test/query-tests/unusedentities Expand file tree Collapse file tree 2 files changed +42
-14
lines changed Original file line number Diff line number Diff line change 5
5
| main.rs:164:9:164:9 | x | Variable is not used. |
6
6
| main.rs:169:9:169:9 | x | Variable is not used. |
7
7
| main.rs:174:9:174:9 | x | Variable is not used. |
8
- | main.rs:195 :17:195 :17 | a | Variable is not used. |
9
- | main.rs:203 :20:203 :22 | val | Variable is not used. |
10
- | main.rs:216 :14:216 :16 | val | Variable is not used. |
11
- | main.rs:218 :9:218 :12 | None | Variable is not used. |
12
- | main.rs:227 :9:227 :12 | None | Variable is not used. |
13
- | main.rs:233 :24:233 :26 | val | Variable is not used. |
8
+ | main.rs:202 :17:202 :17 | a | Variable is not used. |
9
+ | main.rs:210 :20:210 :22 | val | Variable is not used. |
10
+ | main.rs:223 :14:223 :16 | val | Variable is not used. |
11
+ | main.rs:225 :9:225 :12 | None | Variable is not used. |
12
+ | main.rs:234 :9:234 :12 | None | Variable is not used. |
13
+ | main.rs:248 :24:248 :26 | val | Variable is not used. |
Original file line number Diff line number Diff line change @@ -167,12 +167,12 @@ fn loops() {
167
167
for _ in 1 ..10 { }
168
168
169
169
for x // SPURIOUS: unused variable [macros not yet supported]
170
- in 1 ..10 {
170
+ in 1 ..10 {
171
171
println ! ( "x is {}" , x) ;
172
172
}
173
173
174
174
for x // SPURIOUS: unused variable [macros not yet supported]
175
- in 1 ..10 {
175
+ in 1 ..10 {
176
176
assert ! ( x != 11 ) ;
177
177
}
178
178
}
@@ -189,7 +189,14 @@ enum YesOrNo {
189
189
No ,
190
190
}
191
191
192
- fn if_lets ( ) {
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ fn if_lets_matches ( ) {
193
200
let mut total: i64 = 0 ;
194
201
195
202
if let Some ( a) = Some ( 10 ) { // BAD: unused variable
@@ -228,18 +235,39 @@ fn if_lets() {
228
235
}
229
236
}
230
237
231
- let e = MyOption :: Some ( 80 ) ;
232
- match e {
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+ let f = MyOption :: Some ( 90 ) ;
247
+ match f {
233
248
MyOption :: Some ( val) => { // BAD: unused variable
234
249
}
235
250
MyOption :: None => { }
236
251
}
237
252
238
- let f = YesOrNo :: Yes ;
239
- match f {
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ let h = YesOrNo :: Yes ;
261
+ match h {
240
262
YesOrNo :: Yes => { }
241
263
YesOrNo :: No => { }
242
264
}
265
+
266
+
267
+
268
+
269
+
270
+
243
271
}
244
272
245
273
fn main ( ) {
@@ -249,7 +277,7 @@ fn main() {
249
277
arrays ( ) ;
250
278
statics ( ) ;
251
279
loops ( ) ;
252
- if_lets ( ) ;
280
+ if_lets_matches ( ) ;
253
281
254
282
println ! ( "lets use result {}" , parameters( 1 , 2 , 3 ) ) ;
255
283
}
You can’t perform that action at this time.
0 commit comments