aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/syntax.rs
diff options
context:
space:
mode:
authorAlexander Brevig2022-09-13 06:08:23 +0000
committerGitHub2022-09-13 06:08:23 +0000
commit16b9a1841ff2d53e855522d24f0749b06ed30186 (patch)
treee2992cc99b5bbd2ed314e203857b117bd2091407 /helix-core/src/syntax.rs
parent800a4906767d69443cda183acd0e982f88c7b29a (diff)
fix: map_err()? instead of unwrap (#3826)
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r--helix-core/src/syntax.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 6ec56bde..e0a984d2 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,
}