Cleanup: apply "Convert lambda to reference"

This commit is contained in:
Mikhail Glukhikh
2017-02-22 16:12:01 +03:00
parent b121bf8802
commit 045a23ae10
82 changed files with 117 additions and 135 deletions
@@ -42,7 +42,7 @@ abstract class DeclarationLookupObjectImpl(
return if (descriptor != null)
descriptor.importableFqName
else
(psiElement as? PsiClass)?.qualifiedName?.let { FqName(it) }
(psiElement as? PsiClass)?.qualifiedName?.let(::FqName)
}
override fun toString() = super.toString() + " " + (descriptor ?: psiElement)
@@ -111,7 +111,7 @@ class InsertHandlerProvider(
}
}
originalFunction.extensionReceiverParameter?.type?.let { addPotentiallyInferred(it) }
originalFunction.extensionReceiverParameter?.type?.let(::addPotentiallyInferred)
originalFunction.valueParameters.forEach { addPotentiallyInferred(it.type) }
fun allTypeParametersPotentiallyInferred() = originalFunction.typeParameters.all { it in potentiallyInferred }
@@ -153,7 +153,7 @@ fun createKeywordConstructLookupElement(
private fun detectIndent(text: CharSequence, offset: Int): String {
return text.substring(0, offset)
.substringAfterLast('\n')
.takeWhile { it.isWhitespace() }
.takeWhile(Char::isWhitespace)
}
private fun String.indentLinesAfterFirst(indent: String): String {
@@ -412,7 +412,7 @@ class SmartCompletion(
if (descriptor.modality != Modality.ABSTRACT && !descriptor.isInner) {
descriptor.constructors
.filter(visibilityFilter)
.mapNotNullTo(this) { toLookupElement(it) }
.mapNotNullTo(this, ::toLookupElement)
}
}
}