Skip to main content

CRR0001 - Redundant sub-expressions in a binary operation

This analyzer detects identical sub-expressions in the binary operation. Such sub-expressions are redundant and the expression can be simplified.

if ((a > 10) && (a > 10)){  // CRR0001
    bool c = b == "foo" ||  b == "foo";  // CRR0001
}

Use the Simplify Expression refactoring to fix this code.

if (a > 10){
    bool c = b == "foo";
}