]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/needless_bool/simple.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / needless_bool / simple.rs
CommitLineData
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
10fn 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
32fn bool_ret(x: bool) -> bool {
33 if x {
34 return true;
35 } else {
36 return true;
37 };
38}
39
40fn bool_ret2(x: bool) -> bool {
41 if x {
42 return false;
43 } else {
44 return false;
45 };
46}