Skip to content

Commit 9e3f4cd

Browse files
committed
Rust: Accept test changes after merging main.
1 parent 483370d commit 9e3f4cd

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
| main.rs:114:3:114:29 | ExprStmt | This code is never reached. |
1+
| main.rs:216:9:217:9 | MatchArm | This code is never reached. |
2+
| main.rs:218:9:219:9 | MatchArm | This code is never reached. |
3+
| main.rs:224:9:226:9 | MatchArm | This code is never reached. |
4+
| main.rs:227:9:228:9 | MatchArm | This code is never reached. |
5+
| main.rs:233:9:234:9 | MatchArm | This code is never reached. |
6+
| main.rs:235:9:235:28 | MatchArm | This code is never reached. |
7+
| main.rs:240:9:240:26 | MatchArm | This code is never reached. |
8+
| main.rs:241:9:241:25 | MatchArm | This code is never reached. |
9+
| unreachable.rs:12:3:12:17 | ExprStmt | This code is never reached. |
10+
| unreachable.rs:20:3:20:17 | ExprStmt | This code is never reached. |
211
| unreachable.rs:32:3:32:17 | ExprStmt | This code is never reached. |
312
| unreachable.rs:39:3:39:17 | ExprStmt | This code is never reached. |
413
| unreachable.rs:48:2:48:16 | ExprStmt | This code is never reached. |
14+
| unreachable.rs:89:3:89:17 | ExprStmt | This code is never reached. |
15+
| unreachable.rs:97:3:97:17 | ExprStmt | This code is never reached. |
516
| unreachable.rs:105:3:107:3 | MatchArm | This code is never reached. |
617
| unreachable.rs:108:3:110:3 | MatchArm | This code is never reached. |
718
| unreachable.rs:112:2:112:16 | ExprStmt | This code is never reached. |
819
| unreachable.rs:115:3:117:3 | MatchArm | This code is never reached. |
920
| unreachable.rs:118:3:120:3 | MatchArm | This code is never reached. |
1021
| unreachable.rs:122:2:122:16 | ExprStmt | This code is never reached. |
1122
| unreachable.rs:129:3:129:17 | ExprStmt | This code is never reached. |
12-
| unreachable.rs:134:4:134:18 | ExprStmt | This code is never reached. |
1323
| unreachable.rs:138:4:138:18 | ExprStmt | This code is never reached. |
14-
| unreachable.rs:142:4:142:18 | ExprStmt | This code is never reached. |
24+
| unreachable.rs:144:3:144:17 | ExprStmt | This code is never reached. |
1525
| unreachable.rs:150:4:150:18 | ExprStmt | This code is never reached. |
1626
| unreachable.rs:153:2:153:16 | ExprStmt | This code is never reached. |

rust/ql/test/query-tests/unusedentities/main.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn arrays() {
111111

112112
println!("lets use {:?}", js);
113113

114-
for k // SPURIOUS: unused variable [macros not yet supported]
114+
for k
115115
in ks
116116
{
117117
println!("lets use {}", k); // [unreachable FALSE POSITIVE]
@@ -213,32 +213,32 @@ fn if_lets() {
213213

214214
let c = Some(60);
215215
match c {
216-
Some(val) => { // BAD: unused variable
216+
Some(val) => { // BAD: unused variable SPURIOUS: unreachable
217217
}
218-
None => { // SPURIOUS: unused variable 'None'
218+
None => { // SPURIOUS: unused variable 'None', unreachable
219219
}
220220
}
221221

222222
let d = Some(70);
223223
match d {
224-
Some(val) => {
224+
Some(val) => { // SPURIOUS: unreachable
225225
total += val;
226226
}
227-
None => { // SPURIOUS: unused variable 'None'
227+
None => { // SPURIOUS: unused variable 'None', unreachable
228228
}
229229
}
230230

231231
let e = MyOption::Some(80);
232232
match e {
233-
MyOption::Some(val) => { // BAD: unused variable
233+
MyOption::Some(val) => { // BAD: unused variable, unreachable
234234
}
235-
MyOption::None => {}
235+
MyOption::None => {} // SPURIOUS: unreachable
236236
}
237237

238238
let f = YesOrNo::Yes;
239239
match f {
240-
YesOrNo::Yes => {}
241-
YesOrNo::No => {}
240+
YesOrNo::Yes => {} // SPURIOUS: unreachable
241+
YesOrNo::No => {} // SPURIOUS: unreachable
242242
}
243243
}
244244

rust/ql/test/query-tests/unusedentities/unreachable.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ fn do_something() {
99

1010
fn unreachable_if() {
1111
if false {
12-
do_something(); // BAD: unreachable code [NOT DETECTED]
12+
do_something(); // BAD: unreachable code
1313
} else {
1414
do_something();
1515
}
1616

1717
if true {
1818
do_something();
1919
} else {
20-
do_something(); // BAD: unreachable code [NOT DETECTED]
20+
do_something(); // BAD: unreachable code
2121
}
2222

2323
let v = get_a_number();
@@ -86,15 +86,15 @@ fn unreachable_panic() {
8686
if cond() {
8787
do_something();
8888
_ = false && panic!(); // does not panic due to short-circuiting
89-
do_something();
89+
do_something(); // SPURIOUS: unreachable
9090
_ = false || panic!();
9191
do_something(); // BAD: unreachable code [NOT DETECTED]
9292
}
9393

9494
if cond() {
9595
do_something();
9696
_ = true || panic!(); // does not panic due to short-circuiting
97-
do_something();
97+
do_something(); // SPURIOUS: unreachable
9898
_ = true && panic!();
9999
do_something(); // BAD: unreachable code [NOT DETECTED]
100100
}
@@ -131,17 +131,17 @@ fn unreachable_loop() {
131131

132132
if cond() {
133133
while cond() {
134-
do_something();{ // [unreachable FALSE POSITIVE]
134+
do_something();{
135135
}
136136

137137
while false {
138138
do_something(); // BAD: unreachable code
139139
}
140140

141141
while true {
142-
do_something(); // [unreachable FALSE POSITIVE]
142+
do_something();
143143
}
144-
do_something(); // BAD: unreachable code [NOT DETECTED]
144+
do_something(); // BAD: unreachable code
145145
}
146146

147147
loop {

0 commit comments

Comments
 (0)