Cleanup: apply "Convert lambda to reference"
This commit is contained in:
@@ -1416,7 +1416,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
|
||||
|
||||
private fun generateCallOrMarkUnresolved(call: KtCallElement) {
|
||||
if (!generateCall(call)) {
|
||||
val arguments = call.valueArguments.mapNotNull { valueArgument -> valueArgument.getArgumentExpression() }
|
||||
val arguments = call.valueArguments.mapNotNull(ValueArgument::getArgumentExpression)
|
||||
|
||||
for (argument in arguments) {
|
||||
generateInstructions(argument)
|
||||
|
||||
@@ -358,7 +358,7 @@ object Renderers {
|
||||
override fun get(key: TypeConstructor): TypeProjection? {
|
||||
val typeDescriptor = key.declarationDescriptor as? TypeParameterDescriptor ?: return null
|
||||
if (typeDescriptor.containingDeclaration != descriptor.typeAliasDescriptor) return null
|
||||
return inferredTypesForTypeParameters[typeDescriptor.index]?.let { TypeProjectionImpl(it) }
|
||||
return inferredTypesForTypeParameters[typeDescriptor.index]?.let(::TypeProjectionImpl)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ class DeclarationsChecker(
|
||||
) {
|
||||
val upperBounds = descriptor.upperBounds
|
||||
val (boundsWhichAreTypeParameters, otherBounds) = upperBounds
|
||||
.map { type -> type.constructor }
|
||||
.map(KotlinType::constructor)
|
||||
.partition { constructor -> constructor.declarationDescriptor is TypeParameterDescriptor }
|
||||
.let { pair -> pair.first.toSet() to pair.second.toSet() }
|
||||
if (boundsWhichAreTypeParameters.size > 1 || (boundsWhichAreTypeParameters.size == 1 && otherBounds.isNotEmpty())) {
|
||||
@@ -543,9 +543,7 @@ class DeclarationsChecker(
|
||||
val declarationDescriptor = it.constructor.declarationDescriptor
|
||||
if (declarationDescriptor is TypeParameterDescriptor && declarationDescriptor in allTypeParameters) {
|
||||
if (allAccessibleTypeParameters.add(declarationDescriptor)) {
|
||||
declarationDescriptor.upperBounds.forEach {
|
||||
addAccessibleTypeParametersFromType(it)
|
||||
}
|
||||
declarationDescriptor.upperBounds.forEach(::addAccessibleTypeParametersFromType)
|
||||
}
|
||||
}
|
||||
false
|
||||
|
||||
@@ -488,7 +488,7 @@ class QualifiedExpressionResolver {
|
||||
|
||||
return qualifiedExpressions
|
||||
.subList(nextExpressionIndexAfterQualifier, qualifiedExpressions.size)
|
||||
.map { CallExpressionElement(it) }
|
||||
.map(::CallExpressionElement)
|
||||
}
|
||||
|
||||
private fun mapToQualifierParts(qualifiedExpressions: List<KtQualifiedExpression>,
|
||||
|
||||
@@ -127,9 +127,7 @@ fun isOrOverridesSynthesized(descriptor: CallableMemberDescriptor): Boolean {
|
||||
return true
|
||||
}
|
||||
if (descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
return descriptor.overriddenDescriptors.all {
|
||||
isOrOverridesSynthesized(it)
|
||||
}
|
||||
return descriptor.overriddenDescriptors.all(::isOrOverridesSynthesized)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ abstract class SuppressDiagnosticsByAnnotations(
|
||||
) : SuppressStringProvider {
|
||||
|
||||
private val stringsToSuppress = diagnosticsToSuppress.map { it.name.toLowerCase() }
|
||||
private val expectedFqNames = annotationsFqName.map { it.toString() }
|
||||
private val expectedFqNames = annotationsFqName.map(FqName::toString)
|
||||
|
||||
override fun get(annotationDescriptor: AnnotationDescriptor): List<String> {
|
||||
val descriptor = DescriptorUtils.getClassDescriptorForType(annotationDescriptor.type)
|
||||
|
||||
@@ -71,7 +71,7 @@ class FileScopeFactory(
|
||||
|
||||
val extraImports = file.originalFile.virtualFile?.let { vFile ->
|
||||
val scriptExternalDependencies = getScriptExternalDependencies(vFile, file.project)
|
||||
ktImportsFactory.createImportDirectives(scriptExternalDependencies?.imports?.map { ImportPath(it) }.orEmpty())
|
||||
ktImportsFactory.createImportDirectives(scriptExternalDependencies?.imports?.map(::ImportPath).orEmpty())
|
||||
}
|
||||
|
||||
val allImplicitImports = defaultImports concat extraImports
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.descriptors.SourceFile
|
||||
interface PsiSourceElement : SourceElement {
|
||||
val psi: PsiElement?
|
||||
|
||||
override fun getContainingFile(): SourceFile = psi?.containingFile?.let { PsiSourceFile(it) } ?: SourceFile.NO_SOURCE_FILE
|
||||
override fun getContainingFile(): SourceFile = psi?.containingFile?.let(::PsiSourceFile) ?: SourceFile.NO_SOURCE_FILE
|
||||
}
|
||||
|
||||
class PsiSourceFile(val psiFile: PsiFile): SourceFile {
|
||||
|
||||
@@ -47,9 +47,7 @@ abstract class PerformanceCounter protected constructor(val name: String) {
|
||||
|
||||
fun resetAllCounters() {
|
||||
synchronized(allCounters) {
|
||||
allCounters.forEach {
|
||||
it.reset()
|
||||
}
|
||||
allCounters.forEach(PerformanceCounter::reset)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user