about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src/unescape.rs
diff options
context:
space:
mode:
authorMichael Scholten <michael-scholten@hotmail.nl>2024-04-23 11:47:51 +0200
committerMichael Scholten <michael-scholten@hotmail.nl>2024-04-24 09:41:44 +0200
commit3c5e88c7d19fee810ce5bdaaae8c9da8caabd6eb (patch)
tree1719e31cb7b317a8546ce2a4d6bd9f4a52756ceb /compiler/rustc_lexer/src/unescape.rs
parentc67277301c896857d0534f2bb7431680796833fb (diff)
downloadrust-3c5e88c7d19fee810ce5bdaaae8c9da8caabd6eb.tar.gz
rust-3c5e88c7d19fee810ce5bdaaae8c9da8caabd6eb.zip
Improved the compiler code with clippy
Diffstat (limited to 'compiler/rustc_lexer/src/unescape.rs')
-rw-r--r--compiler/rustc_lexer/src/unescape.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_lexer/src/unescape.rs b/compiler/rustc_lexer/src/unescape.rs
index 03d178eb266..d6ea4249247 100644
--- a/compiler/rustc_lexer/src/unescape.rs
+++ b/compiler/rustc_lexer/src/unescape.rs
@@ -259,7 +259,7 @@ fn scan_escape<T: From<char> + From<u8>>(
             } else {
                 // This may be a high byte, but that will only happen if `T` is
                 // `MixedUnit`, because of the `allow_high_bytes` check above.
-                Ok(T::from(value as u8))
+                Ok(T::from(value))
             };
         }
         'u' => return scan_unicode(chars, mode.allow_unicode_escapes()).map(T::from),
@@ -300,7 +300,7 @@ fn scan_unicode(chars: &mut Chars<'_>, allow_unicode_escapes: bool) -> Result<ch
                     return Err(EscapeError::UnicodeEscapeInByte);
                 }
 
-                break std::char::from_u32(value).ok_or_else(|| {
+                break std::char::from_u32(value).ok_or({
                     if value > 0x10FFFF {
                         EscapeError::OutOfRangeUnicodeEscape
                     } else {