Structural equality tests should use == or !=

Apache 2.0

In Kotlin, == means structural equality and != structural inequality and both map to the left-side term’s equals() function. It is, therefore, redundant to call equals() as a function. Also, == and != are more general than equals() and !equals() because it allows either of both operands to be null. Developers using equals() instead of == or != is often the result of adapting styles from other languages like Java, where == means reference equality and != means reference inequality. The == and != operators are a more concise and elegant way to test structural equality than calling a function.

org.openrewrite.kotlin.cleanup.EqualsMethodUsage
mod run . --recipe=org.openrewrite.kotlin.cleanup.EqualsMethodUsage

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