"Remove redundant let" inspection: do not report for long call chains #KT-26289 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
c6db26ba91
commit
ae4ff45750
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ReplaceSingleLineLetInspection
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filter { it > 1 }.filter { it > 2 }.let<caret> { println(it) }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
println(list.filter { it > 1 }.filter { it > 2 })
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filter { it > 1 }.filter { it > 2 }
|
||||
.let<caret> { println(it) }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
println(list.filter { it > 1 }.filter { it > 2 })
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filter { it > 1 }.filter { it > 2 }.let<caret> {
|
||||
println(it)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
println(list.filter { it > 1 }.filter { it > 2 })
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filter { it > 1 }
|
||||
.filter { it > 2 }
|
||||
.let<caret> { println(it) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filter { it > 1 }.filter { it > 2 }.filter { it > 3 }.let<caret> { println(it) }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun String.test(): Int {
|
||||
return let<caret> {
|
||||
it.length
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun String.test(): Int {
|
||||
return length
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(s: String?): Int? {
|
||||
return s?.let<caret> {
|
||||
it.length
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(s: String?): Int? {
|
||||
return s?.length
|
||||
}
|
||||
Reference in New Issue
Block a user