Skip to content

Commit

Permalink
Fix warnings in lex.rs (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
kulakowski-wasm authored Oct 7, 2022
1 parent 42caf67 commit 4dff58c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/wit-parser/src/ast/lex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ impl<'a> Tokenizer<'a> {
Ok(ret)
}

// This is going to be used shortly for a new feature.
#[allow(dead_code)]
pub fn parse_str(&self, span: Span) -> Result<String> {
let mut ret = String::new();
let s = self.get_span(span);
Expand Down Expand Up @@ -367,11 +369,11 @@ impl<'a> Tokenizer<'a> {
Some((_, '"')) => return Ok(None),
Some((_, '\\')) => match self.chars.next() {
Some((_, '"')) => '"',
Some((_, '\'')) => ('\''),
Some((_, 't')) => ('\t'),
Some((_, 'n')) => ('\n'),
Some((_, 'r')) => ('\r'),
Some((_, '\\')) => ('\\'),
Some((_, '\'')) => '\'',
Some((_, 't')) => '\t',
Some((_, 'n')) => '\n',
Some((_, 'r')) => '\r',
Some((_, '\\')) => '\\',
Some((i, c)) => return Err(Error::InvalidEscape(i, c)),
None => return Err(Error::UnterminatedString(start)),
},
Expand Down

0 comments on commit 4dff58c

Please sign in to comment.