Redundant 'with' call
Reports redundant with
function calls that don't access anything from the receiver.
Examples:
class MyClass {
fun f(): String = ""
}
fun testRedundant() {
with(c) { // <== 'with' is redundant since 'c' isn't used
println("1")
}
}
fun testOk() {
val c = MyClass()
with(c) { // <== OK because 'f()' is effectively 'c.f()'
println(f())
}
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023