For each parameter not used: introduce "replace with repeat"
An enhancement for KT-27209
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Introduce anonymous parameter
|
||||
|
||||
fun test(list: List<String>) {
|
||||
list.for<caret>Each {}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Introduce anonymous parameter
|
||||
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { _ -> }
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Replace with 'repeat(size)'
|
||||
|
||||
fun test(list: List<String>) {
|
||||
list.for<caret>Each {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Replace with 'repeat(size)'
|
||||
|
||||
fun test(list: List<String>) {
|
||||
repeat(list.size) {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<String>?) {
|
||||
list?.for<caret>Each {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<String>?) {
|
||||
list?.forEach { _ -> }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Replace with 'repeat(size)'
|
||||
|
||||
fun test(sequence: Sequence<String>) {
|
||||
sequence.for<caret>Each {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Replace with 'repeat(size)'
|
||||
|
||||
fun test(sequence: Sequence<String>) {
|
||||
repeat(sequence.count()) {}
|
||||
}
|
||||
Reference in New Issue
Block a user