TrailingCommaPostFormatProcessor: convert mapNotNull to filter
#KT-34744
This commit is contained in:
@@ -42,12 +42,9 @@ class TrailingCommaPostFormatProcessor : PostFormatProcessor {
|
|||||||
companion object {
|
companion object {
|
||||||
fun findInvalidCommas(commaOwner: KtElement): List<PsiElement> = commaOwner.firstChild
|
fun findInvalidCommas(commaOwner: KtElement): List<PsiElement> = commaOwner.firstChild
|
||||||
?.siblings(withItself = false)
|
?.siblings(withItself = false)
|
||||||
?.mapNotNull { element ->
|
?.filter { it.isComma }
|
||||||
if (!element.isComma) return@mapNotNull null
|
?.filter {
|
||||||
element.takeIf {
|
it.prevLeaf(true)?.isLineBreak() == true || it.leafIgnoringWhitespace(false) != it.leafIgnoringWhitespaceAndComments(false)
|
||||||
it.prevLeaf(true)?.isLineBreak() == true ||
|
|
||||||
it.leafIgnoringWhitespace(false) != it.leafIgnoringWhitespaceAndComments(false)
|
|
||||||
}
|
|
||||||
}?.toList().orEmpty()
|
}?.toList().orEmpty()
|
||||||
|
|
||||||
fun needComma(
|
fun needComma(
|
||||||
|
|||||||
Reference in New Issue
Block a user