Skip to content

Commit

Permalink
Move get_slice to use safe code
Browse files Browse the repository at this point in the history
  • Loading branch information
Zibi Braniecki committed Jan 23, 2019
1 parent 793b019 commit a4af23a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fluent-syntax/src/parser/ftlstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl<'p> ParserStream<'p> {
}

pub fn get_slice(&self, start: usize, end: usize) -> &'p str {
unsafe { str::from_utf8_unchecked(&self.source[start..end]) }
str::from_utf8(&self.source[start..end]).expect("Slicing the source failed")
}

pub fn skip_digits(&mut self) -> Result<()> {
Expand Down

0 comments on commit a4af23a

Please sign in to comment.