Skip to content

Commit

Permalink
refactor: use method reference when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd committed Nov 26, 2019
1 parent 6aacec7 commit 4facbeb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}

0 comments on commit 4facbeb

Please sign in to comment.