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