title: Kotlin Filter - The Expression is Unused
body: <p>I have a Kotlin application that filters a collection elements in a manner similar to the following:</p>
  
  <pre><code>fun main() {
      val strings = arrayOf("A", "B", "C")
      val acceptAll = true
      println(
              strings.filter {
                  if (acceptAll) {
                      true // "The expression is unused"
                  }
                  // Other filters
                  false
              }
      )
  }
  </code></pre>
  
  <p>However, the <code>true</code> line is highlighted by IntelliJ with the message "The expression is unused". Sure enough, my program does not hit that code path, the filter returns <code>false</code>, and I end up with an empty array.</p>
  
  <p>This is a simplified example, but it illustrates what it is that I'm trying to accomplish.</p>
  
  <p>Any suggestions would be greatly appreciated.</p>
  
  <p>Thank you!</p>