Skip to content

Remove-Redundant-Boolean

Sourcery rule id: remove-redundant-boolean

Description

Remove unnecessary boolean value

Before

while (first_condition && true && second_condition) {
  do_something();
}

After

while (first_condition && second_condition) {
  do_something();
}

Explanation

This rule removes unnecessary true values from && boolean operators, since something && true has exactly the same meaning as something