crates/lint/docs/boolean-cst.md
Severity: Med
ID: boolean-cst
Flags expressions where a boolean constant (true/false) is used as a control-flow condition
or operand of a boolean operator, which usually indicates dead code or a leftover debug toggle.
Reports if (true), if (false), while (true) outside of intentional infinite loops, and
boolean operators (&&, ||) where one side is a literal true/false.
A literal boolean as a condition makes the surrounding branch dead, hides logic errors, or preserves a forgotten debug shortcut that bypasses real checks.
if (true) { // always taken
doSomething();
}
require(condition && true, "unreachable"); // 'true' is redundant
if (condition) {
doSomething();
}
require(condition, "...");