Prefer direct comparison of numbers

MSAL

Replace a - b == 0 with a == b, a - b != 0 with a != b, a - b < 0 with a < b, and similar transformations for all comparison operators to improve readability and avoid overflow issues.

org.openrewrite.staticanalysis.PreferEqualityComparisonOverDifferenceCheck
mod run . --recipe=org.openrewrite.staticanalysis.PreferEqualityComparisonOverDifferenceCheck

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.