Skip to content

Commit

Permalink
fix: map_err()? instead of unwrap (helix-editor#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBrevig authored and Shekhinah Memmel committed Dec 11, 2022
1 parent 787d2e8 commit 351f80d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1135,6 +1137,7 @@ pub struct Highlight(pub usize);
pub enum Error {
Cancelled,
InvalidLanguage,
InvalidRanges,
Unknown,
}

Expand Down

0 comments on commit 351f80d

Please sign in to comment.