报告可被简化为单个表达式的布尔 if 表达式和语句。

示例:


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

在应用快速修复后:


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

该检查还可以简化其中一个分支为布尔常量的分支:


  val filterModified = if (condition) {
      someBooleanExpression
  } else {
      false
  }

在应用快速修复后:


  val filterModified = condition && someBooleanExpression