Skip to content

Possible-Incorrect-Bitwise-Operator

Sourcery rule id: possible-incorrect-bitwise-operator

Description

Flags possibly incorrect use of bitwise operators | and &.

Match

if (x & y) {}

Explanation

Although bitwise operators are valid in boolean contexts, it's more likely to be a programming error, as it's easy to mix up & with && and | with ||.