menu

no-self-assignment

Disallow assigning a stable place to itself

Assigning a stable storage place to itself leaves its value unchanged and performs a useless write. Instead, you SHOULD remove the assignment or correct the unintended operand.

Reported

1function retain(value: int32): int32 {2    let result = value;3    result = result;4    return result;5}

Accepted

1function retain(value: int32): int32 {2    const result = value;3    return result;4}