Back to Intellij Community

RedundantIf

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/RedundantIf.html

2025.3-rc-2291 B
Original Source

Reports if statements which can be simplified to a single statement.

Example:

fun test(): Boolean {
      if (foo()) {
         return true
      } else {
         return false
      }
  }

After the quick-fix is applied:

fun test(): Boolean {
      return foo()
  }