Skip to content

identical-binary-operands

Default severity: warning

Comparisons and non-idempotent operations with identical expressions on both sides are usually copy-and-paste mistakes. Floating-point expressions are excluded because NaN makes self-comparisons meaningful.

if left == left { use() }
if left == right { use() }