Use mutableIntStateOf instead of mutableStateOf<Int> in Compose

Proprietary

Compose's mutableIntStateOf keeps the wrapped value as a primitive Int, avoiding the autobox-and-unbox cost that mutableStateOf<Int> pays on every read and write inside a recomposition.

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