Use toSet() instead of toMutableSet().toSet()
ProprietarytoMutableSet() already allocates a fresh set — calling toSet() on it copies again. Go directly to toSet().
org. openrewrite. kotlin. stdlib. UseSetForMutableSetToSet$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. stdlib. UseSetForMutableSetToSet$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.