Open
Description
Similar to #58546
BAD:
bool foo = false;
// ...
if (foo = true) {}
else if (foo = false) {}
while (foo = true) {} // or false
do {} while (foo = true); // or false
GOOD:
bool foo = false;
// ...
if (foo == true) {}
while (foo == true) {}
do {} while (foo == true);
These lints should apply if the literal true
or false
is used. I'm not sure if they should apply when a const expression that evaluates to true or false is used. I think they should not apply if some non-const expression is used, e.g. while (keepGoing = checkIfIShouldKeepGoing())
would not trigger the lint.