Find if (x != null) x.foo() patterns

Proprietary

if (x != null) { x.foo() } is the long form of x?.let { it.foo() } — or, when only one call is needed and x is a local, x?.foo(). The safe-call form makes the null-aware path part of the type system rather than a separate Boolean check.

org.openrewrite.kotlin.bestpractices.FindLetForNotNullCheck$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.bestpractices.FindLetForNotNullCheck$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.