fix: map_err()? instead of unwrap (#3826)

pull/3839/head
Alexander Brevig 2 years ago committed by GitHub
parent 800a490676
commit 16b9a1841f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,
}

Loading…
Cancel
Save