Simplifiable call inspection: add filter -> filterNotNull replacement
Related to KT-30501
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.<caret>filter({ it != null })
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.filterNotNull()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
fun test(map: Map<String?, String?>) {
|
||||
map.<caret>filter { (k, v) -> k != null && v != null }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.<caret>filter { arg -> arg != null }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.filterNotNull()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
fun test(list: List<Boolean>) {
|
||||
list.<caret>filter { it }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.<caret>filter { it !== null }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.filterNotNull()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
fun test(map: Map<String?, String?>) {
|
||||
map.<caret>filter { it != null }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.<caret>filter { null != it }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.filterNotNull()
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.<caret>filter { it != null }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String?>) {
|
||||
list.filterNotNull()
|
||||
}
|
||||
Reference in New Issue
Block a user