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 55| main.rs:164:9:164:9 | x | Variable is not used. |
66| main.rs:169:9:169:9 | x | Variable is not used. |
77| 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() {
167167 for _ in 1 ..10 { }
168168
169169 for x // SPURIOUS: unused variable [macros not yet supported]
170- in 1 ..10 {
170+ in 1 ..10 {
171171 println ! ( "x is {}" , x) ;
172172 }
173173
174174 for x // SPURIOUS: unused variable [macros not yet supported]
175- in 1 ..10 {
175+ in 1 ..10 {
176176 assert ! ( x != 11 ) ;
177177 }
178178}
@@ -189,7 +189,14 @@ enum YesOrNo {
189189 No ,
190190}
191191
192- fn if_lets ( ) {
192+
193+
194+
195+
196+
197+
198+
199+ fn if_lets_matches ( ) {
193200 let mut total: i64 = 0 ;
194201
195202 if let Some ( a) = Some ( 10 ) { // BAD: unused variable
@@ -228,18 +235,39 @@ fn if_lets() {
228235 }
229236 }
230237
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 {
233248 MyOption :: Some ( val) => { // BAD: unused variable
234249 }
235250 MyOption :: None => { }
236251 }
237252
238- let f = YesOrNo :: Yes ;
239- match f {
253+
254+
255+
256+
257+
258+
259+
260+ let h = YesOrNo :: Yes ;
261+ match h {
240262 YesOrNo :: Yes => { }
241263 YesOrNo :: No => { }
242264 }
265+
266+
267+
268+
269+
270+
243271}
244272
245273fn main ( ) {
@@ -249,7 +277,7 @@ fn main() {
249277 arrays ( ) ;
250278 statics ( ) ;
251279 loops ( ) ;
252- if_lets ( ) ;
280+ if_lets_matches ( ) ;
253281
254282 println ! ( "lets use result {}" , parameters( 1 , 2 , 3 ) ) ;
255283}
You can’t perform that action at this time.
0 commit comments