Skip to content

Commit 9bda1e2

Browse files
committed
Add run-rustfix for short_circuit_statement test
1 parent 6d9ee9e commit 9bda1e2

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run-rustfix
2+
3+
#![warn(clippy::short_circuit_statement)]
4+
#![allow(clippy::nonminimal_bool)]
5+
6+
fn main() {
7+
if f() { g(); }
8+
if !f() { g(); }
9+
if !(1 == 2) { g(); }
10+
}
11+
12+
fn f() -> bool {
13+
true
14+
}
15+
16+
fn g() -> bool {
17+
false
18+
}

tests/ui/short_circuit_statement.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
// run-rustfix
2+
13
#![warn(clippy::short_circuit_statement)]
4+
#![allow(clippy::nonminimal_bool)]
25

36
fn main() {
47
f() && g();

tests/ui/short_circuit_statement.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: boolean short circuit operator in statement may be clearer using an explicit test
2-
--> $DIR/short_circuit_statement.rs:4:5
2+
--> $DIR/short_circuit_statement.rs:7:5
33
|
44
LL | f() && g();
55
| ^^^^^^^^^^^ help: replace it with: `if f() { g(); }`
66
|
77
= note: `-D clippy::short-circuit-statement` implied by `-D warnings`
88

99
error: boolean short circuit operator in statement may be clearer using an explicit test
10-
--> $DIR/short_circuit_statement.rs:5:5
10+
--> $DIR/short_circuit_statement.rs:8:5
1111
|
1212
LL | f() || g();
1313
| ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }`
1414

1515
error: boolean short circuit operator in statement may be clearer using an explicit test
16-
--> $DIR/short_circuit_statement.rs:6:5
16+
--> $DIR/short_circuit_statement.rs:9:5
1717
|
1818
LL | 1 == 2 || g();
1919
| ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }`

0 commit comments

Comments
 (0)