Skip to content

Commit 16b9a18

Browse files
fix: map_err()? instead of unwrap (#3826)
1 parent 800a490 commit 16b9a18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

helix-core/src/syntax.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,9 @@ impl LanguageLayer {
985985
}
986986

987987
fn parse(&mut self, parser: &mut Parser, source: &Rope) -> Result<(), Error> {
988-
parser.set_included_ranges(&self.ranges).unwrap();
988+
parser
989+
.set_included_ranges(&self.ranges)
990+
.map_err(|_| Error::InvalidRanges)?;
989991

990992
parser
991993
.set_language(self.config.language)
@@ -1135,6 +1137,7 @@ pub struct Highlight(pub usize);
11351137
pub enum Error {
11361138
Cancelled,
11371139
InvalidLanguage,
1140+
InvalidRanges,
11381141
Unknown,
11391142
}
11401143

0 commit comments

Comments
 (0)