Inspectopedia Help

Lambda argument inside parentheses

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 } }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023