Suggest to replace 'substring' calls by take/drop/dropLast calls when possible

Code review fixes
#KT-10196 Fixed
This commit is contained in:
Anton Sukhonosenko
2016-01-14 22:40:50 +03:00
parent ba0efda2f0
commit b2e98e9353
23 changed files with 87 additions and 147 deletions
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithDropIntention
@@ -1,5 +0,0 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(4)
}
@@ -1,5 +0,0 @@
// WITH_RUNTIME
fun foo(s: String) {
s.drop(4)
}
@@ -1,5 +0,0 @@
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(4);
}
@@ -1,5 +0,0 @@
// WITH_RUNTIME
fun foo(s: String) {
s.drop(4);
}
@@ -1,6 +0,0 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo(s: String) {
s.substring<caret>(0, 10)
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class A() {
fun bar(): String = null!!
}
fun foo(a: A) {
a.bar().substring<caret>(0, a.bar().length - 5)
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class A() {
fun bar(): String = null!!
}
fun foo(a: A) {
a.bar().substring<caret>(a.bar().indexOf('x'))
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class A() {
fun bar(): String = null!!
}
fun foo(a: A) {
a.bar().substring<caret>(0, a.bar().indexOf('x'))
}