on master help sign in
syntax: highlight_iter always returns Ok()
081e0aeBlaž Hrastnik
helix-core/src/syntax.rs+2−2
@@ -269,7 +269,7 @@ impl Syntax {
269 range: Option<std::ops::Range<usize>>,
269 range: Option<std::ops::Range<usize>>,
270 cancellation_flag: Option<&'a AtomicUsize>,
270 cancellation_flag: Option<&'a AtomicUsize>,
271 mut injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
271 mut injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
272− ) -> Result<impl Iterator<Item = Result<HighlightEvent, Error>> + 'a, Error> {
272+ ) -> impl Iterator<Item = Result<HighlightEvent, Error>> + 'a {
273 // The `captures` iterator borrows the `Tree` and the `QueryCursor`, which
273 // The `captures` iterator borrows the `Tree` and the `QueryCursor`, which
274 // prevents them from being moved. But both of these values are really just
274 // prevents them from being moved. But both of these values are really just
275 // pointers, so it's actually ok to move them.
275 // pointers, so it's actually ok to move them.
@@ -325,7 +325,7 @@ impl Syntax {
325 last_highlight_range: None,
325 last_highlight_range: None,
326 };
326 };
327 result.sort_layers();
327 result.sort_layers();
328− Ok(result)
328+ result
329 }
329 }
330 // on_tokenize
330 // on_tokenize
331 // on_change_highlighting
331 // on_change_highlighting
helix-term/src/ui/editor.rs−1
@@ -94,7 +94,6 @@ impl EditorView {
94 Some(syntax) => {
94 Some(syntax) => {
95 syntax
95 syntax
96 .highlight_iter(text.slice(..), Some(range), None, |_| None)
96 .highlight_iter(text.slice(..), Some(range), None, |_| None)
97− .unwrap()
98 .collect() // TODO: we collect here to avoid holding the lock, fix later
97 .collect() // TODO: we collect here to avoid holding the lock, fix later
99 }
98 }
100 None => vec![Ok(HighlightEvent::Source {
99 None => vec![Ok(HighlightEvent::Source {