2019-08-05 15:05:05 -05:00
|
|
|
#![warn(clippy::needless_bool)]
|
|
|
|
#![allow(
|
|
|
|
unused,
|
|
|
|
dead_code,
|
|
|
|
clippy::no_effect,
|
|
|
|
clippy::if_same_then_else,
|
2021-02-25 16:33:46 -06:00
|
|
|
clippy::needless_return,
|
2021-04-01 11:30:47 -05:00
|
|
|
clippy::branches_sharing_code
|
2019-08-05 15:05:05 -05:00
|
|
|
)]
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|