This rule detects ?: emptyList() that can be replaced with orEmpty() call.
fun test(x: List<Int>?, s: String?) { val a = x ?: emptyList() val b = s ?: ""}
fun test(x: List<Int>?, s: String?) { val a = x.orEmpty() val b = s.orEmpty()}
The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html