File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
1
+ // run-rustfix
2
+
1
3
#![ warn( clippy:: short_circuit_statement) ]
4
+ #![ allow( clippy:: nonminimal_bool) ]
2
5
3
6
fn main ( ) {
4
7
f ( ) && g ( ) ;
Original file line number Diff line number Diff line change 1
1
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
3
3
|
4
4
LL | f() && g();
5
5
| ^^^^^^^^^^^ help: replace it with: `if f() { g(); }`
6
6
|
7
7
= note: `-D clippy::short-circuit-statement` implied by `-D warnings`
8
8
9
9
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
11
11
|
12
12
LL | f() || g();
13
13
| ^^^^^^^^^^^ help: replace it with: `if !f() { g(); }`
14
14
15
15
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
17
17
|
18
18
LL | 1 == 2 || g();
19
19
| ^^^^^^^^^^^^^^ help: replace it with: `if !(1 == 2) { g(); }`
You can’t perform that action at this time.
0 commit comments