Back to Intellij Community

MoveLambdaOutsideParentheses

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/MoveLambdaOutsideParentheses.html

2025.3-rc-2252 B
Original Source

Reports lambda expressions in parentheses which can be moved outside.

Example:

fun square(a: Int, b: (Int) -> Int) {
  b(a * a)
}

fun foo() {
  square(2, { it })
}

After the quick-fix is applied:

fun foo() {
  square(2){ it }
}