Closed
Description
Expected Behavior
If we use the return value of apply
, the UnnecessaryApply
rule should never flag that usage.
Observed Behavior
UnnecessaryApply
flags some of those.
Steps to Reproduce
val a = listOf(mutableListOf(""))
.map { it.apply { add("") } }
Context
Reported by zmunm in slack: https://kotlinlang.slack.com/archives/C88E12QH4/p1596599789239000
I really don't like this code because it goes agains immutability. But it's legit code so we should not flag it in this rule.
Your Environment
- Version of detekt used: master, 1.11.0-RC1