From 2811b9faefdeb867b2d30ad32787801f0fff481e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Bj=C3=B8rnager=20Jensen?= Date: Tue, 24 Sep 2024 09:16:32 +0200 Subject: [PATCH] Update Unicode escapes; --- library/core/src/char/methods.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 3dcaab6a12beb..632a37ea90db1 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -69,7 +69,7 @@ impl char { /// assert_eq!(char::from_u32(value_at_max + 1), None); /// ``` #[stable(feature = "assoc_char_consts", since = "1.52.0")] - pub const MAX: char = '\u{10ffff}'; + pub const MAX: char = '\u{10FFFF}'; /// `U+FFFD REPLACEMENT CHARACTER` (�) is used in Unicode to represent a /// decoding error. @@ -847,7 +847,7 @@ impl char { /// assert!('\n'.is_whitespace()); /// /// // a non-breaking space - /// assert!('\u{A0}'.is_whitespace()); + /// assert!('\u{00A0}'.is_whitespace()); /// /// assert!(!'越'.is_whitespace()); /// ``` @@ -1015,7 +1015,7 @@ impl char { /// Both are equivalent to: /// /// ``` - /// println!("i\u{307}"); + /// println!("i\u{0307}"); /// ``` /// /// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string): @@ -1024,7 +1024,7 @@ impl char { /// assert_eq!('C'.to_lowercase().to_string(), "c"); /// /// // Sometimes the result is more than one character: - /// assert_eq!('İ'.to_lowercase().to_string(), "i\u{307}"); + /// assert_eq!('İ'.to_lowercase().to_string(), "i\u{0307}"); /// /// // Characters that do not have both uppercase and lowercase /// // convert into themselves. @@ -1837,7 +1837,6 @@ pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] { } (2, [a, b, ..]) => { code -= 0x1_0000; - *a = (code >> 10) as u16 | 0xD800; *b = (code & 0x3FF) as u16 | 0xDC00; }