From ec2f9091a06d07a8c4faa7533b814bdf59e36c35 Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sat, 18 Mar 2023 20:32:34 +0100 Subject: [PATCH] Simplify Display implementation for LanguageServerFeature --- helix-core/src/syntax.rs | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index a4e6d990b..ce26a1bc0 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -242,25 +242,27 @@ pub enum LanguageServerFeature { impl Display for LanguageServerFeature { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", match self { - LanguageServerFeature::Format => "format", - LanguageServerFeature::GotoDeclaration => "goto-declaration", - LanguageServerFeature::GotoDefinition => "goto-definition", - LanguageServerFeature::GotoTypeDefinition => "goto-type-definition", - LanguageServerFeature::GotoReference => "goto-type-definition", - LanguageServerFeature::GotoImplementation => "goto-implementation", - LanguageServerFeature::SignatureHelp => "signature-help", - LanguageServerFeature::Hover => "hover", - LanguageServerFeature::DocumentHighlight => "document-highlight", - LanguageServerFeature::Completion => "completion", - LanguageServerFeature::CodeAction => "code-action", - LanguageServerFeature::WorkspaceCommand => "workspace-command", - LanguageServerFeature::DocumentSymbols => "document-symbols", - LanguageServerFeature::WorkspaceSymbols => "workspace-symbols", - LanguageServerFeature::Diagnostics => "diagnostics", - LanguageServerFeature::RenameSymbol => "rename-symbol", - LanguageServerFeature::InlayHints => "inlay-hints", - }) + use LanguageServerFeature::*; + let feature = match self { + Format => "format", + GotoDeclaration => "goto-declaration", + GotoDefinition => "goto-definition", + GotoTypeDefinition => "goto-type-definition", + GotoReference => "goto-type-definition", + GotoImplementation => "goto-implementation", + SignatureHelp => "signature-help", + Hover => "hover", + DocumentHighlight => "document-highlight", + Completion => "completion", + CodeAction => "code-action", + WorkspaceCommand => "workspace-command", + DocumentSymbols => "document-symbols", + WorkspaceSymbols => "workspace-symbols", + Diagnostics => "diagnostics", + RenameSymbol => "rename-symbol", + InlayHints => "inlay-hints", + }; + write!(f, "{feature}",) } }