From 16b9a1841ff2d53e855522d24f0749b06ed30186 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Tue, 13 Sep 2022 08:08:23 +0200 Subject: [PATCH] fix: map_err()? instead of unwrap (#3826) --- helix-core/src/syntax.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 6ec56bde2..e0a984d20 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -985,7 +985,9 @@ impl LanguageLayer { } fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> { - parser.set_included_ranges(&self.ranges).unwrap(); + parser + .set_included_ranges(&self.ranges) + .map_err(|_| Error::InvalidRanges)?; parser .set_language(self.config.language) @@ -1135,6 +1137,7 @@ pub struct Highlight(pub usize); pub enum Error { Cancelled, InvalidLanguage, + InvalidRanges, Unknown, }