Use length instead of String.count()

Proprietary

String.count() walks every character and increments a counter. length reads the precomputed size off the String header.

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