about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-06-17 11:54:25 +0000
committerbors <bors@rust-lang.org>2015-06-17 11:54:25 +0000
commitd24dd3191a533d4a9cf1193a66141df09f46d17d (patch)
tree08f2843e4d4d4ec8e2bee6744bd2dd5caf874d50
parentd2c223a3774c011ecda7dbab231e4f4904640b5d (diff)
parent667a24644270ba9b76a8413cd5bf5ccc49ad12cd (diff)
downloadrust-d24dd3191a533d4a9cf1193a66141df09f46d17d.tar.gz
rust-d24dd3191a533d4a9cf1193a66141df09f46d17d.zip
Auto merge of #26261 - tshepang:more-brief-example, r=huonw
Also, it feels more suitable to use hex to represent unicode
-rw-r--r--src/libcore/char.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index 9938c299615..df371752b86 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -74,17 +74,8 @@ pub const MAX: char = '\u{10ffff}';
 /// ```
 /// use std::char;
 ///
-/// let c = char::from_u32(10084); // produces `Some(❤)`
-/// assert_eq!(c, Some('❤'));
-/// ```
-///
-/// An invalid character:
-///
-/// ```
-/// use std::char;
-///
-/// let none = char::from_u32(1114112);
-/// assert_eq!(none, None);
+/// assert_eq!(char::from_u32(0x2764), Some('❤'));
+/// assert_eq!(char::from_u32(0x110000), None); // invalid character
 /// ```
 #[inline]
 #[stable(feature = "rust1", since = "1.0.0")]