From 2b746ea6fa6f7040e3ea51e1386bb914333594f4 Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Wed, 5 Apr 2023 18:56:19 +0200 Subject: Some minor clarity/cosmetic improvements Co-authored-by: Pascal Kuthe --- helix-term/src/commands/lsp.rs | 2 +- helix-view/src/editor.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index f7d35873..948f3484 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -1395,7 +1395,7 @@ pub fn rename_symbol(cx: &mut Context) { let Some(language_server) = doc .language_servers_with_feature(LanguageServerFeature::RenameSymbol) - .find(|ls| language_server_id.is_none() || Some(ls.id()) == language_server_id) + .find(|ls| language_server_id.map_or(true, |id| id == ls.id())) else { cx.editor.set_error("No configured language server supports symbol renaming"); return; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index afb8d91f..280002bd 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1136,8 +1136,9 @@ impl Editor { let doc_language_servers_not_in_registry = doc.language_servers.iter().filter(|(name, doc_ls)| { - !language_servers.contains_key(*name) - || language_servers[*name].id() != doc_ls.id() + language_servers + .get(*name) + .map_or(true, |ls| ls.id() != doc_ls.id()) }); for (_, language_server) in doc_language_servers_not_in_registry { @@ -1145,8 +1146,9 @@ impl Editor { } let language_servers_not_in_doc = language_servers.iter().filter(|(name, ls)| { - !doc.language_servers.contains_key(*name) - || doc.language_servers[*name].id() != ls.id() + doc.language_servers + .get(*name) + .map_or(true, |doc_ls| ls.id() != doc_ls.id()) }); for (_, language_server) in language_servers_not_in_doc { -- cgit v1.2.3-70-g09d2