Use toSet() instead of toList().toSet()

Proprietary

toSet() works on any Iterable. The intermediate toList() just allocates a list that's immediately discarded.

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