Skip to content

Commit

Permalink
Try to fix doc links in new char methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed May 3, 2020
1 parent 68f89fc commit 0e12a9d
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/libcore/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ use super::*;
impl char {
/// The highest valid code point a `char` can have.
///
/// A [`char`] is a [Unicode Scalar Value], which means that it is a [Code
/// A `char` is a [Unicode Scalar Value], which means that it is a [Code
/// Point], but only ones within a certain range. `MAX` is the highest valid
/// code point that's a valid [Unicode Scalar Value].
///
/// [`char`]: ../../std/primitive.char.html
/// [Unicode Scalar Value]: http://www.unicode.org/glossary/#unicode_scalar_value
/// [Code Point]: http://www.unicode.org/glossary/#code_point
#[unstable(feature = "assoc_char_consts", reason = "recently added", issue = "71763")]
Expand All @@ -25,7 +24,7 @@ impl char {
/// decoding error.
///
/// It can occur, for example, when giving ill-formed UTF-8 bytes to
/// [`String::from_utf8_lossy`](../../std/string/struct.String.html#method.from_utf8_lossy).
/// [`String::from_utf8_lossy`](string/struct.String.html#method.from_utf8_lossy).
#[unstable(feature = "assoc_char_consts", reason = "recently added", issue = "71763")]
pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';

Expand Down Expand Up @@ -96,7 +95,7 @@ impl char {

/// Converts a `u32` to a `char`.
///
/// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
/// `as`:
///
/// ```
Expand All @@ -107,16 +106,15 @@ impl char {
/// ```
///
/// However, the reverse is not true: not all valid [`u32`]s are valid
/// [`char`]s. `from_u32()` will return `None` if the input is not a valid value
/// for a [`char`].
/// `char`s. `from_u32()` will return `None` if the input is not a valid value
/// for a `char`.
///
/// [`char`]: ../../std/primitive.char.html
/// [`u32`]: ../../std/primitive.u32.html
/// [`u32`]: primitive.u32.html
///
/// For an unsafe version of this function which ignores these checks, see
/// [`from_u32_unchecked`].
///
/// [`from_u32_unchecked`]: fn.from_u32_unchecked.html
/// [`from_u32_unchecked`]: #method.from_u32_unchecked
///
/// # Examples
///
Expand All @@ -130,7 +128,7 @@ impl char {
/// assert_eq!(Some('❤'), c);
/// ```
///
/// Returning `None` when the input is not a valid [`char`]:
/// Returning `None` when the input is not a valid `char`:
///
/// ```
/// use std::char;
Expand All @@ -147,7 +145,7 @@ impl char {

/// Converts a `u32` to a `char`, ignoring validity.
///
/// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with
/// Note that all `char`s are valid [`u32`]s, and can be cast to one with
/// `as`:
///
/// ```
Expand All @@ -158,19 +156,18 @@ impl char {
/// ```
///
/// However, the reverse is not true: not all valid [`u32`]s are valid
/// [`char`]s. `from_u32_unchecked()` will ignore this, and blindly cast to
/// [`char`], possibly creating an invalid one.
/// `char`s. `from_u32_unchecked()` will ignore this, and blindly cast to
/// `char`, possibly creating an invalid one.
///
/// [`char`]: ../../std/primitive.char.html
/// [`u32`]: ../../std/primitive.u32.html
/// [`u32`]: primitive.u32.html
///
/// # Safety
///
/// This function is unsafe, as it may construct invalid `char` values.
///
/// For a safe version of this function, see the [`from_u32`] function.
///
/// [`from_u32`]: fn.from_u32.html
/// [`from_u32`]: #method.from_u32
///
/// # Examples
///
Expand Down

0 comments on commit 0e12a9d

Please sign in to comment.