Can someone help me understand why the `MissingUse...
# detekt
b
Can someone help me understand why the
MissingUseCall
rule detects the following as not using
use
?
Copy code
val code = """
            fun <T> MyCloseable.useMe(block: (object) -> T) = use { block(this) }
            fun MyCloseable.useMe() = use {}



            fun test() {
                MyCloseable(0).use {}
                MyCloseable(1).useMe()
                MyCloseable(2).useMe { it.doStuff() }
            }

            ${myClosable(clazz)}
        """.trimIndent()
These are obviously contrived, we have a pattern that would look more like:
Copy code
MyCloseable(0).use { it.subPropertyClosable.use { sub -> sub.doStuff() } }
I was trying to shorthand that to something like the
useMe
block except it's more like
fun <T> MyCloseable.useMe(block: () -> T ) = use { subPropertyCloseable.use { block() } }
, but I get an error that
MyCloseable
is doesn't call
use
to access the
Closeable
.