diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-12 19:49:53 +0100 |
|---|---|---|
| committer | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-12 19:49:53 +0100 |
| commit | 2ea368e53c755fb13d3ad5cd59370a3f7ad4e8c0 (patch) | |
| tree | 10026afe25c4eca8d57fb9444793f89ca0581396 /compiler/rustc_lexer/src | |
| parent | 37d7de337903a558dbeb1e82c844fe915ab8ff25 (diff) | |
| download | rust-2ea368e53c755fb13d3ad5cd59370a3f7ad4e8c0.tar.gz rust-2ea368e53c755fb13d3ad5cd59370a3f7ad4e8c0.zip | |
minor code cleanups
Diffstat (limited to 'compiler/rustc_lexer/src')
| -rw-r--r-- | compiler/rustc_lexer/src/unescape.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_lexer/src/unescape.rs b/compiler/rustc_lexer/src/unescape.rs index e405013dcab..87c44638a8d 100644 --- a/compiler/rustc_lexer/src/unescape.rs +++ b/compiler/rustc_lexer/src/unescape.rs @@ -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; } }; |
