ITADN

`needless_bool` should handle logical and/or

#17170Openronnodas 创建于 2026-06-06
C-enhancement
R
ronnodascommented
### Description The lint `needless_bool` should also trigger on `if x { true } else { y }` and `if x { y } else { false }`, suggesting `x || y` and `x && y` respectively. Some more variations: - `if x { false } else { y }` -> `(!x) && y` - `if x { x } else { y }` -> `x || y` ### Additional Labels @rustbot label +C-enhancement
0 条评论