Skip to content

Commit d24dd31

Browse files
committed
Auto merge of #26261 - tshepang:more-brief-example, r=huonw
Also, it feels more suitable to use hex to represent unicode
2 parents d2c223a + 667a246 commit d24dd31

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/libcore/char.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,8 @@ pub const MAX: char = '\u{10ffff}';
7474
/// ```
7575
/// use std::char;
7676
///
77-
/// let c = char::from_u32(10084); // produces `Some(❤)`
78-
/// assert_eq!(c, Some('❤'));
79-
/// ```
80-
///
81-
/// An invalid character:
82-
///
83-
/// ```
84-
/// use std::char;
85-
///
86-
/// let none = char::from_u32(1114112);
87-
/// assert_eq!(none, None);
77+
/// assert_eq!(char::from_u32(0x2764), Some('❤'));
78+
/// assert_eq!(char::from_u32(0x110000), None); // invalid character
8879
/// ```
8980
#[inline]
9081
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)