mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Clean up code using the newly minted RedundantAsSequenceInspection
#KTIJ-31931 GitOrigin-RevId: d6de482f23d5c57dba23b2994ed65aaea94527ed
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4d714d9033
commit
6346b08aa2
@@ -34,7 +34,7 @@ internal suspend fun generateClasspath(context: BuildContext): List<String> {
|
||||
val excluded = excludedLibJars(context)
|
||||
val existing = HashSet<Path>()
|
||||
Files.newDirectoryStream(libDir).use { stream ->
|
||||
stream.asSequence().filterTo(existing) { it.toString().endsWith(".jar") && !excluded.contains(it.fileName.toString()) }
|
||||
stream.filterTo(existing) { it.toString().endsWith(".jar") && !excluded.contains(it.fileName.toString()) }
|
||||
}
|
||||
val result = computeAppClassPath(libDir, existing).map { libDir.relativize(it).toString() }
|
||||
span.setAttribute(AttributeKey.stringArrayKey("result"), result)
|
||||
|
||||
@@ -209,7 +209,7 @@ object FileTypeUsageCounterCollector : CounterUsagesCollector() {
|
||||
return
|
||||
}
|
||||
val fileNameMatchers = fileTypeManager.getStandardMatchers(fileType)
|
||||
fileNameMatchers.asSequence()
|
||||
fileNameMatchers
|
||||
.firstOrNull { it.acceptsCharSequence(file.getName()) }
|
||||
?.let {
|
||||
data.add(FILE_NAME_PATTERN_FIELD.with(it.getPresentableString()))
|
||||
|
||||
@@ -63,7 +63,7 @@ class SeResultListModel: DefaultListModel<SeResultListRow>() {
|
||||
private fun firstIndexOrNull(fullSearch: Boolean, predicate: (SeItemData) -> Boolean): Int? {
|
||||
val startIndex = if (fullSearch || ignoreFreezing) 0 else frozenCount
|
||||
|
||||
return (startIndex until size).asSequence().firstOrNull { index ->
|
||||
return (startIndex until size).firstOrNull { index ->
|
||||
when (val row = getElementAt(index)) {
|
||||
is SeResultListItemRow -> {
|
||||
predicate(row.item)
|
||||
|
||||
@@ -269,7 +269,7 @@ internal class WorkspaceMetaModelBuilder(
|
||||
classSymbol.classKind == KaClassKind.ENUM_CLASS -> {
|
||||
val enumEntries = classSymbol.staticMemberScope.callables.filterIsInstance<KaEnumEntrySymbol>().map { it.name.asString() }
|
||||
ValueType.Enum<Any>(javaClassFqn, superTypesJavaFqns, enumEntries.toList(),
|
||||
createProperties(classSymbol, knownTypes).asSequence().withoutEnumFields().toList())
|
||||
createProperties(classSymbol, knownTypes).withoutEnumFields().toList())
|
||||
}
|
||||
classSymbol.modality == KaSymbolModality.SEALED && classSymbol is KaNamedClassSymbol -> {
|
||||
val subclasses = classSymbol.sealedClassInheritors
|
||||
|
||||
@@ -105,7 +105,7 @@ fun checkDeclarationNewNameConflicts(
|
||||
if (symbol is KaValueParameterSymbol) {
|
||||
val functionLikeSymbol = containingSymbol as KaFunctionSymbol
|
||||
val locals = functionLikeSymbol.psi?.descendantsOfType<KtVariableDeclaration>()?.filter { it.nameAsName == newName }
|
||||
?.mapNotNull { it.symbol }?.asSequence() ?: emptySequence()
|
||||
?.mapNotNull { it.symbol } ?: emptySequence()
|
||||
return functionLikeSymbol.valueParameters.filter { it.name == newName }.asSequence() + locals
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ internal object FirKotlinUastConstantEvaluator {
|
||||
if (operands.any { it is String } && operator != UastBinaryOperator.PLUS) {
|
||||
return null
|
||||
}
|
||||
return operands.asSequence().reduceOrNull { opr1, opr2 ->
|
||||
return operands.reduceOrNull { opr1, opr2 ->
|
||||
if (opr1 is String || opr2 is String) {
|
||||
return@reduceOrNull opr1.toString() + opr2.toString()
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ internal val PythonAddInterpreterModel.existingSdks
|
||||
get() = allInterpreters.value.filterIsInstance<ExistingSelectableInterpreter>().map { it.sdk }
|
||||
|
||||
internal fun PythonAddInterpreterModel.findInterpreter(path: String): PythonSelectableInterpreter? {
|
||||
return allInterpreters.value.asSequence().find { it.homePath == path }
|
||||
return allInterpreters.value.find { it.homePath == path }
|
||||
}
|
||||
|
||||
internal suspend fun PythonAddInterpreterModel.detectCondaEnvironmentsOrError(errorSink: ErrorSink) {
|
||||
|
||||
@@ -181,7 +181,7 @@ private suspend fun getPipFileLockRequirements(virtualFile: VirtualFile, package
|
||||
.filterNot { (_, pkg) -> pkg.editable ?: false }
|
||||
// TODO: Support requirements markers (PEP 496), currently any packages with markers are ignored due to PY-30803
|
||||
.filter { (_, pkg) -> pkg.markers == null }
|
||||
.flatMap { (name, pkg) -> packageManager.parseRequirements("$name${pkg.version ?: ""}") }.asSequence()
|
||||
.flatMap { (name, pkg) -> packageManager.parseRequirements("$name${pkg.version ?: ""}") }
|
||||
.toList()
|
||||
|
||||
val pipFileLock = parsePipFileLock(virtualFile).getOrNull() ?: return null
|
||||
|
||||
@@ -21,7 +21,7 @@ interface UastCodeGenerationPlugin {
|
||||
private val extensionPointName = ExtensionPointName<UastCodeGenerationPlugin>("org.jetbrains.uast.generate.uastCodeGenerationPlugin")
|
||||
|
||||
@JvmStatic
|
||||
fun byLanguage(language: Language): UastCodeGenerationPlugin? = extensionPointName.extensionList.asSequence().firstOrNull { it.language == language }
|
||||
fun byLanguage(language: Language): UastCodeGenerationPlugin? = extensionPointName.extensionList.firstOrNull { it.language == language }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user