tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
Vendored
+33
-33
@@ -2,37 +2,37 @@
|
||||
|
||||
fun test(list: List<Int>): List<Pair<IndexedValue<List<Int>>, IndexedValue<List<Int>>>> {
|
||||
return list
|
||||
.asSequence()
|
||||
.chunked(1)
|
||||
.distinct()
|
||||
.distinctBy { it }
|
||||
.drop(1)
|
||||
.dropWhile { true }
|
||||
.filter { true }
|
||||
.filterIndexed { index, list -> true }
|
||||
.filterIsInstance<Int>()
|
||||
.filterNot { true }
|
||||
.filterNotNull()
|
||||
.map { it }
|
||||
.mapIndexed { index, i -> i }
|
||||
.mapIndexedNotNull { index, i -> i }
|
||||
.mapNotNull { it }
|
||||
.minus(1)
|
||||
.minusElement(1)
|
||||
.onEach {}
|
||||
.plus(1)
|
||||
.plusElement(1)
|
||||
.requireNoNulls()
|
||||
.sorted()
|
||||
.sortedBy { it }
|
||||
.sortedByDescending { it }
|
||||
.sortedDescending()
|
||||
.sortedWith(Comparator { o1, o2 -> 0 })
|
||||
.take(1)
|
||||
.takeWhile { true }
|
||||
.windowed(1, 1, true)
|
||||
.withIndex()
|
||||
.zipWithNext()
|
||||
.zipWithNext { a, b -> a }
|
||||
.toList()
|
||||
.asSequence()
|
||||
.chunked(1)
|
||||
.distinct()
|
||||
.distinctBy { it }
|
||||
.drop(1)
|
||||
.dropWhile { true }
|
||||
.filter { true }
|
||||
.filterIndexed { index, list -> true }
|
||||
.filterIsInstance<Int>()
|
||||
.filterNot { true }
|
||||
.filterNotNull()
|
||||
.map { it }
|
||||
.mapIndexed { index, i -> i }
|
||||
.mapIndexedNotNull { index, i -> i }
|
||||
.mapNotNull { it }
|
||||
.minus(1)
|
||||
.minusElement(1)
|
||||
.onEach {}
|
||||
.plus(1)
|
||||
.plusElement(1)
|
||||
.requireNoNulls()
|
||||
.sorted()
|
||||
.sortedBy { it }
|
||||
.sortedByDescending { it }
|
||||
.sortedDescending()
|
||||
.sortedWith(Comparator { o1, o2 -> 0 })
|
||||
.take(1)
|
||||
.takeWhile { true }
|
||||
.windowed(1, 1, true)
|
||||
.withIndex()
|
||||
.zipWithNext()
|
||||
.zipWithNext { a, b -> a }
|
||||
.toList()
|
||||
}
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
fun test(list: List<Int>): Int {
|
||||
return list // comment1
|
||||
.<caret>filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
.sum() // comment4
|
||||
.<caret>filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
.sum() // comment4
|
||||
}
|
||||
+4
-4
@@ -2,8 +2,8 @@
|
||||
|
||||
fun test(list: List<Int>): Int {
|
||||
return list // comment1
|
||||
.asSequence()
|
||||
.filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
.sum() // comment4
|
||||
.asSequence()
|
||||
.filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
.sum() // comment4
|
||||
}
|
||||
+2
-2
@@ -2,6 +2,6 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list // comment1
|
||||
.<caret>filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
.<caret>filter { it > 1 } // comment2
|
||||
.map { it * 2 } // comment3
|
||||
}
|
||||
+4
-4
@@ -2,8 +2,8 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list // comment1
|
||||
.asSequence()
|
||||
.filter { it > 1 } // comment2
|
||||
.map { it * 2 }
|
||||
.toList() // comment3
|
||||
.asSequence()
|
||||
.filter { it > 1 } // comment2
|
||||
.map { it * 2 }
|
||||
.toList() // comment3
|
||||
}
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
|
||||
fun test(list: List<List<Int>>): List<Int> {
|
||||
return list
|
||||
.<caret>filter { it.count() > 2 }
|
||||
.map { it + it }
|
||||
.flatMap { it + it }
|
||||
.<caret>filter { it.count() > 2 }
|
||||
.map { it + it }
|
||||
.flatMap { it + it }
|
||||
}
|
||||
idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt.after
Vendored
+5
-5
@@ -2,9 +2,9 @@
|
||||
|
||||
fun test(list: List<List<Int>>): List<Int> {
|
||||
return list
|
||||
.asSequence()
|
||||
.filter { it.count() > 2 }
|
||||
.map { it + it }
|
||||
.toList()
|
||||
.flatMap { it + it }
|
||||
.asSequence()
|
||||
.filter { it.count() > 2 }
|
||||
.map { it + it }
|
||||
.toList()
|
||||
.flatMap { it + it }
|
||||
}
|
||||
Vendored
+5
-5
@@ -2,9 +2,9 @@
|
||||
|
||||
fun test(): Int {
|
||||
return listOf(1, 2, 3)
|
||||
.<caret>filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.let {
|
||||
it.binarySearch(1)
|
||||
}
|
||||
.<caret>filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.let {
|
||||
it.binarySearch(1)
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -2,11 +2,11 @@
|
||||
|
||||
fun test(): Int {
|
||||
return listOf(1, 2, 3)
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.toList()
|
||||
.let {
|
||||
it.binarySearch(1)
|
||||
}
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.toList()
|
||||
.let {
|
||||
it.binarySearch(1)
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -2,8 +2,8 @@
|
||||
|
||||
fun test(list: List<Int>?): List<Int>? {
|
||||
return list
|
||||
?.asSequence()
|
||||
?.filter { it > 1 }
|
||||
?.map { it * 2 }
|
||||
?.toList()
|
||||
?.asSequence()
|
||||
?.filter { it > 1 }
|
||||
?.map { it * 2 }
|
||||
?.toList()
|
||||
}
|
||||
Vendored
+7
-7
@@ -2,11 +2,11 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.mapNotNull {
|
||||
if (it == 2) return@mapNotNull null
|
||||
it * 2
|
||||
}
|
||||
.toList()
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.mapNotNull {
|
||||
if (it == 2) return@mapNotNull null
|
||||
it * 2
|
||||
}
|
||||
.toList()
|
||||
}
|
||||
+2
-1
@@ -3,5 +3,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(): List<Int> {
|
||||
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }.toList()
|
||||
return listOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.map { it * 3 }.map { it * 4 }.map { it * 5 }
|
||||
.toList()
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list
|
||||
.filter<caret> { it > 1 }
|
||||
.map { it * 2 }
|
||||
.map { it * 3 }
|
||||
.map { it * 4 }
|
||||
.filter<caret> { it > 1 }
|
||||
.map { it * 2 }
|
||||
.map { it * 3 }
|
||||
.map { it * 4 }
|
||||
}
|
||||
+6
-6
@@ -3,10 +3,10 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.map { it * 3 }
|
||||
.map { it * 4 }
|
||||
.toList()
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.map { it * 3 }
|
||||
.map { it * 4 }
|
||||
.toList()
|
||||
}
|
||||
+5
-5
@@ -2,9 +2,9 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list
|
||||
.reversed()
|
||||
.<caret>map { it + 1 }
|
||||
.map { it + 1 }
|
||||
.dropLast(1)
|
||||
.takeLast(2)
|
||||
.reversed()
|
||||
.<caret>map { it + 1 }
|
||||
.map { it + 1 }
|
||||
.dropLast(1)
|
||||
.takeLast(2)
|
||||
}
|
||||
+8
-8
@@ -2,11 +2,11 @@
|
||||
|
||||
fun test(list: List<Int>): List<Int> {
|
||||
return list
|
||||
.reversed()
|
||||
.asSequence()
|
||||
.map { it + 1 }
|
||||
.map { it + 1 }
|
||||
.toList()
|
||||
.dropLast(1)
|
||||
.takeLast(2)
|
||||
}
|
||||
.reversed()
|
||||
.asSequence()
|
||||
.map { it + 1 }
|
||||
.map { it + 1 }
|
||||
.toList()
|
||||
.dropLast(1)
|
||||
.takeLast(2)
|
||||
}
|
||||
+4
-4
@@ -2,10 +2,10 @@
|
||||
|
||||
fun test(foo: Foo): List<Int> {
|
||||
return foo.getList()
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.toList()
|
||||
.asSequence()
|
||||
.filter { it > 1 }
|
||||
.map { it * 2 }
|
||||
.toList()
|
||||
}
|
||||
|
||||
class Foo {
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }.filterIndexedTo(mutableListOf()) { index, it -> true }
|
||||
val filterIndexedTo: MutableList<Int> = list.asSequence().filter { it > 1 }
|
||||
.filterIndexedTo(mutableListOf()) { index, it -> true }
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
|
||||
val mapIndexedNotNullTo: MutableList<Int> = list.asSequence().filter { it > 1 }
|
||||
.mapIndexedNotNullTo(mutableListOf()) { index, i -> i }
|
||||
}
|
||||
Reference in New Issue
Block a user