]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #![warn(clippy::needless_bool)] |
2 | #![allow( | |
3 | unused, | |
4 | dead_code, | |
5 | clippy::no_effect, | |
6 | clippy::if_same_then_else, | |
7 | clippy::needless_return | |
8 | )] | |
9 | ||
10 | fn main() { | |
11 | let x = true; | |
12 | let y = false; | |
13 | if x { | |
14 | true | |
15 | } else { | |
16 | true | |
17 | }; | |
18 | if x { | |
19 | false | |
20 | } else { | |
21 | false | |
22 | }; | |
23 | if x { | |
24 | x | |
25 | } else { | |
26 | false | |
27 | }; // would also be questionable, but we don't catch this yet | |
28 | bool_ret(x); | |
29 | bool_ret2(x); | |
30 | } | |
31 | ||
32 | fn bool_ret(x: bool) -> bool { | |
33 | if x { | |
34 | return true; | |
35 | } else { | |
36 | return true; | |
37 | }; | |
38 | } | |
39 | ||
40 | fn bool_ret2(x: bool) -> bool { | |
41 | if x { | |
42 | return false; | |
43 | } else { | |
44 | return false; | |
45 | }; | |
46 | } |