Pattern: Ignored return value
Issue: -
Warns on instances where a function, annotated with either @CheckReturnValue
or @CheckResult
, returns a value but that value is not used in any way. The Kotlin compiler gives no warning for this scenario normally so that's the rationale behind this rule.
Example of incorrect code:
returnsValue()
Example of correct code:
if (42 == returnsValue()) {}
val x = returnsValue()