Find if (x == null) return ... early-exit patterns
ProprietaryAn if (x == null) return … reads as a manual null guard where Kotlin's x ?: return … says the same thing inline. The elvis form keeps the expression in line with its consumer and avoids a separate control-flow statement.
org. openrewrite. kotlin. idiom. FindIfNullReturn$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. idiom. FindIfNullReturn$KtRecipe'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.