]> git.lizzy.rs Git - rust.git/blob - tests/ui/short_circuit_statement.rs
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / short_circuit_statement.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #![deny(short_circuit_statement)]
5
6 fn main() {
7     f() && g();
8     //~^ ERROR boolean short circuit operator
9     //~| HELP replace it with
10     //~| SUGGESTION if f() { g(); }
11     f() || g();
12     //~^ ERROR boolean short circuit operator
13     //~| HELP replace it with
14     //~| SUGGESTION if !f() { g(); }
15     1 == 2 || g();
16     //~^ ERROR boolean short circuit operator
17     //~| HELP replace it with
18     //~| SUGGESTION if !(1 == 2) { g(); }
19 }
20
21 fn f() -> bool {
22     true
23 }
24
25 fn g() -> bool {
26     false
27 }