Binary Operation Identity

Python pattern

Some binary operations can be simplified into constants, this lint performs those simplifications.


Apply with the Grit CLI
grit apply binary_op_ident

Binary operation identity

BEFORE
x | x
x & x
x ^ x
x - x
x / x
x // x
x % x

x + x
x * x
AFTER
x
x
0
0
1
1
0

x + x
x * x