Add quickfixes for unnecessary casts and nullability operations to cleanup inspection. Rewrite two quickfixes from Java to Kotlin. Add inspection description. Use marker interface for identifying quickfixes applicable for code cleanup.
This commit is contained in:
@@ -30,3 +30,15 @@ fun foo() {
|
||||
continue@loop
|
||||
}
|
||||
}
|
||||
|
||||
fun unnecessarySafeCall(x: String) {
|
||||
x?.length()
|
||||
}
|
||||
|
||||
fun unnecessaryExclExcl(x: String) {
|
||||
x!!.length()
|
||||
}
|
||||
|
||||
fun unnecessaryCast(x: String) = x as String
|
||||
|
||||
fun unnecessaryElvis(x: String) = x ?: ""
|
||||
|
||||
@@ -32,3 +32,15 @@ fun foo() {
|
||||
continue@loop
|
||||
}
|
||||
}
|
||||
|
||||
fun unnecessarySafeCall(x: String) {
|
||||
x.length()
|
||||
}
|
||||
|
||||
fun unnecessaryExclExcl(x: String) {
|
||||
x.length()
|
||||
}
|
||||
|
||||
fun unnecessaryCast(x: String) = x
|
||||
|
||||
fun unnecessaryElvis(x: String) = x
|
||||
|
||||
Reference in New Issue
Block a user