diff options
author | Philipp Mildenberger | 2023-07-27 02:57:19 +0000 |
---|---|---|
committer | GitHub | 2023-07-27 02:57:19 +0000 |
commit | 8a28f3059398eec7b5496bb1088b4d9870e6eb7e (patch) | |
tree | 77cf35ee489ed5367dc2a1ac8b4a0600530ded37 /helix-term/src/ui | |
parent | 262a595e5343c5afd0f2570859b63ebf4c12b0fa (diff) |
Reformat with nightly rustfmt for better let-else formatting (#7721)
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/completion.rs | 16 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 11 |
2 files changed, 20 insertions, 7 deletions
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<T: Item + 'static> Picker<T> { 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<T: Item + 'static> Picker<T> { 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::<Overlay<Self>>() else { + let Some(Overlay { + content: picker, .. + }) = compositor.find::<Overlay<Self>>() + else { log::info!("picker closed before syntax highlighting finished"); - return + return; }; // Try to find a document in the cache let doc = match current_file { |