minor code cleanups
This commit is contained in:
parent
37d7de3379
commit
2ea368e53c
8 changed files with 11 additions and 20 deletions
|
@ -204,14 +204,13 @@ fn scan_escape(chars: &mut Chars<'_>, is_byte: bool) -> Result<char, EscapeError
|
|||
})?;
|
||||
}
|
||||
Some(c) => {
|
||||
let digit =
|
||||
let digit: u32 =
|
||||
c.to_digit(16).ok_or(EscapeError::InvalidCharInUnicodeEscape)?;
|
||||
n_digits += 1;
|
||||
if n_digits > 6 {
|
||||
// Stop updating value since we're sure that it's incorrect already.
|
||||
continue;
|
||||
}
|
||||
let digit = digit as u32;
|
||||
value = value * 16 + digit;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue