Cleanup: apply "cascade if..." inspection (+ some others)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9c06739594
commit
1d2017b0fc
+7
-10
@@ -80,16 +80,13 @@ class SuppressLintIntentionAction(val id: String, val element: PsiElement) : Int
|
||||
val args = entry.valueArgumentList
|
||||
val psiFactory = KtPsiFactory(entry)
|
||||
val newArgList = psiFactory.createCallArguments("($argument)")
|
||||
if (args == null) {
|
||||
// new argument list
|
||||
entry.addAfter(newArgList, entry.lastChild)
|
||||
}
|
||||
else if (args.arguments.isEmpty()) {
|
||||
// replace '()' with a new argument list
|
||||
args.replace(newArgList)
|
||||
}
|
||||
else if (args.arguments.none { it.textMatches(argument) }) {
|
||||
args.addArgument(newArgList.arguments[0])
|
||||
when {
|
||||
args == null -> // new argument list
|
||||
entry.addAfter(newArgList, entry.lastChild)
|
||||
args.arguments.isEmpty() -> // replace '()' with a new argument list
|
||||
args.replace(newArgList)
|
||||
args.arguments.none { it.textMatches(argument) } ->
|
||||
args.addArgument(newArgList.arguments[0])
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user