From 8a28f3059398eec7b5496bb1088b4d9870e6eb7e Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Thu, 27 Jul 2023 04:57:19 +0200 Subject: Reformat with nightly rustfmt for better let-else formatting (#7721) --- helix-term/src/ui/completion.rs | 16 +++++++++++++--- helix-term/src/ui/picker.rs | 11 +++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index c7f9250d..e0614722 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -144,7 +144,9 @@ impl Completion { } }; - let Some(range) = util::lsp_range_to_range(doc.text(), edit.range, offset_encoding) else{ + let Some(range) = + util::lsp_range_to_range(doc.text(), edit.range, offset_encoding) + else { return Transaction::new(doc.text()); }; @@ -413,10 +415,18 @@ impl Completion { _ => return false, }; - let Some(language_server) = cx.editor.language_server_by_id(current_item.language_server_id) else { return false; }; + let Some(language_server) = cx + .editor + .language_server_by_id(current_item.language_server_id) + else { + return false; + }; // This method should not block the compositor so we handle the response asynchronously. - let Some(future) = language_server.resolve_completion_item(current_item.item.clone()) else { return false; }; + let Some(future) = language_server.resolve_completion_item(current_item.item.clone()) + else { + return false; + }; cx.callback( future, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 4605e2f1..f80bc512 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -432,7 +432,7 @@ impl Picker { fn handle_idle_timeout(&mut self, cx: &mut Context) -> EventResult { let Some((current_file, _)) = self.current_file(cx.editor) else { - return EventResult::Consumed(None) + return EventResult::Consumed(None); }; // Try to find a document in the cache @@ -459,11 +459,14 @@ impl Picker { let callback = move |editor: &mut Editor, compositor: &mut Compositor| { let Some(syntax) = syntax else { log::info!("highlighting picker item failed"); - return + return; }; - let Some(Overlay { content: picker, .. }) = compositor.find::>() else { + let Some(Overlay { + content: picker, .. + }) = compositor.find::>() + else { log::info!("picker closed before syntax highlighting finished"); - return + return; }; // Try to find a document in the cache let doc = match current_file { -- cgit v1.2.3-70-g09d2