From 081e0ae8ae4ead621010e7e6a060194fe2433bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 16 Mar 2021 13:49:22 +0900 Subject: [PATCH] syntax: highlight_iter always returns Ok() --- helix-core/src/syntax.rs | 4 ++-- helix-term/src/ui/editor.rs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index c698b000..acf4ad61 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -269,7 +269,7 @@ impl Syntax { range: Option>, cancellation_flag: Option<&'a AtomicUsize>, mut injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a, - ) -> Result> + 'a, Error> { + ) -> impl Iterator> + 'a { // The `captures` iterator borrows the `Tree` and the `QueryCursor`, which // prevents them from being moved. But both of these values are really just // pointers, so it's actually ok to move them. @@ -325,7 +325,7 @@ impl Syntax { last_highlight_range: None, }; result.sort_layers(); - Ok(result) + result } // on_tokenize // on_change_highlighting diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index ff3c70cf..31a19649 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -94,7 +94,6 @@ impl EditorView { Some(syntax) => { syntax .highlight_iter(text.slice(..), Some(range), None, |_| None) - .unwrap() .collect() // TODO: we collect here to avoid holding the lock, fix later } None => vec![Ok(HighlightEvent::Source {