From 4facbeb5900a7f0d547fbe002763ca314d21e3ed Mon Sep 17 00:00:00 2001 From: Edoardo Luppi Date: Tue, 26 Nov 2019 10:38:48 +0100 Subject: [PATCH] refactor: use method reference when possible --- .../cc/configuration/holders/CommitTokensFilePickerHolder.kt | 4 ++-- .../com/github/lppedd/cc/liveTemplate/CommitScopeMacro.kt | 2 +- .../com/github/lppedd/cc/liveTemplate/CommitSubjectMacro.kt | 2 +- .../com/github/lppedd/cc/liveTemplate/CommitTypeMacro.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/github/lppedd/cc/configuration/holders/CommitTokensFilePickerHolder.kt b/src/main/kotlin/com/github/lppedd/cc/configuration/holders/CommitTokensFilePickerHolder.kt index 2efc7507..178e21a9 100644 --- a/src/main/kotlin/com/github/lppedd/cc/configuration/holders/CommitTokensFilePickerHolder.kt +++ b/src/main/kotlin/com/github/lppedd/cc/configuration/holders/CommitTokensFilePickerHolder.kt @@ -47,7 +47,7 @@ internal class CommitTokensFilePickerHolder(private val disposable: Disposable) customFile.text = FileUtil.toSystemDependentName(path) ComponentValidator .getInstance(customFile) - .ifPresent { it.revalidate() } + .ifPresent(ComponentValidator::revalidate) } else { isCustomFile.isSelected = false customFile.isEnabled = false @@ -106,7 +106,7 @@ internal class CommitTokensFilePickerHolder(private val disposable: Disposable) override fun textChanged(e: DocumentEvent) { ComponentValidator .getInstance(customFile) - .ifPresent { it.revalidate() } + .ifPresent(ComponentValidator::revalidate) } }) } diff --git a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitScopeMacro.kt b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitScopeMacro.kt index bfa32ba5..339b7dd8 100644 --- a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitScopeMacro.kt +++ b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitScopeMacro.kt @@ -66,7 +66,7 @@ internal class CommitScopeMacro : CommitMacro() { CommitScopeProvider.EP_NAME.getExtensions(project) .flatMap { it.getCommitScopes(commitType) } .map { CommitScopePsiElement(it, psiManager) } - .mapIndexed { i, psi -> CommitScopeLookupElement(i, psi) } + .mapIndexed(::CommitScopeLookupElement) .forEach { lookup.addItem(it, PrefixMatcher.ALWAYS_TRUE) } } } diff --git a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitSubjectMacro.kt b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitSubjectMacro.kt index ac3c98d8..017c7260 100644 --- a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitSubjectMacro.kt +++ b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitSubjectMacro.kt @@ -19,7 +19,7 @@ class CommitSubjectMacro : CommitMacro() { CommitSubjectProvider.EP_NAME.getExtensions(project) .flatMap { it.getCommitSubjects("", "") } .map { CommitSubjectPsiElement(it, psiManager) } - .mapIndexed { i, psi -> CommitSubjectLookupElement(i, psi) } + .mapIndexed(::CommitSubjectLookupElement) .forEach { lookup.addItem(it, PrefixMatcher.ALWAYS_TRUE) } } } diff --git a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitTypeMacro.kt b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitTypeMacro.kt index 37897fa0..3f286024 100644 --- a/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitTypeMacro.kt +++ b/src/main/kotlin/com/github/lppedd/cc/liveTemplate/CommitTypeMacro.kt @@ -51,7 +51,7 @@ class CommitTypeMacro : CommitMacro() { CommitTypeProvider.EP_NAME.getExtensions(project) .flatMap { it.getCommitTypes("") } .map { CommitTypePsiElement(it, psiManager) } - .mapIndexed { i, psi -> CommitTypeLookupElement(i, psi) } + .mapIndexed(::CommitTypeLookupElement) .forEach { lookup.addItem(it, PrefixMatcher.ALWAYS_TRUE) } } }