Unused unary operator
Reports unary operators for number types on unused expressions.
Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading.
Example:
fun main() {
val result = 1 + 2 * 3
+ 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused
println("Result = $result") // The result is '7' and not '10' as it might be expected
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023