Do not use "Remove redundant '.let' call" when receiver is used #KT-14390 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
6a1b0b9cbc
commit
0b57d8eb49
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun baz(foo: String) {
|
||||
foo.let<caret> { it.substringAfterLast(it.capitalize()) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun baz(foo: String) {
|
||||
foo.let<caret> { it.substringAfterLast("".equals(it).toString()) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun baz(foo: String) {
|
||||
foo.let<caret> { it.substring(0, it.length) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
fun baz(foo: String) {
|
||||
foo.let<caret> { it.indexOfLast { c -> c == it[0] } }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// IS_APPLICABLE: false
|
||||
// This should be reported. However, in order to avoid too complecate logic, the intention ignore this case.
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun baz2(foo: List<String>) {
|
||||
foo.let<caret> { it.binarySearch("", Comparator<kotlin.String> { o1, o2 -> 0 }) }
|
||||
}
|
||||
Reference in New Issue
Block a user