Proposal/idea for 'Destructured parameter 'abc' is never used' warning

I prefer to use this:

val result = listOfPairs
.groupBy { (theId, aValue) -> theId }

... instead of this:

val result = listOfPairs
.groupBy { it.first }

Since in this example I have no use for .second, the IDE suggest to replace it with an underscore:

val result = listOfPairs
.groupBy { (theId, _) -> theId }

But now I have lost important information about the second property of the Pair. Of course I can turn off the warnings, but only globally. So I add a comment:

val result = listOfPairs
.groupBy { (theId, _ /* aValue */) -> theId }

My idea would be for the IDE to accept certain names and not give a warning, for example like this:

val result = listOfPairs
.groupBy { (theId, _aValue) -> theId } // Would give no warning
val result = listOfPairs
.groupBy { (theId, aValue) -> theId } // Gives a warning
0

I created a feature request - https://youtrack.jetbrains.com/issue/KTIJ-21462. Feel free to follow it.

0

请先登录再写评论。