Skip to content

Commit 0165a4c

Browse files
committed
Use u32::from for MIN/MAX examples
1 parent b64f3c7 commit 0165a4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/char/methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl char {
3636
/// let c: char = something_which_returns_char();
3737
/// assert!(char::MIN <= c);
3838
///
39-
/// let value_at_min = char::MIN as u32;
39+
/// let value_at_min = u32::from(char::MIN);
4040
/// assert_eq!(char::from_u32(value_at_min), Some('\0'));
4141
/// ```
4242
#[unstable(feature = "char_min", issue = "114298")]
@@ -68,7 +68,7 @@ impl char {
6868
/// let c: char = something_which_returns_char();
6969
/// assert!(c <= char::MAX);
7070
///
71-
/// let value_at_max = char::MAX as u32;
71+
/// let value_at_max = u32::from(char::MAX);
7272
/// assert_eq!(char::from_u32(value_at_max), Some('\u{10FFFF}'));
7373
/// assert_eq!(char::from_u32(value_at_max + 1), None);
7474
/// ```

0 commit comments

Comments
 (0)