Skip to content

Commit

Permalink
Rollup merge of #75807 - jyn514:num-intra-link, r=poliorcetics
Browse files Browse the repository at this point in the history
Convert core/num/mod.rs to intra-doc links

Helps with #75080.
This can't convert the associated constants `MAX` and `MIN` until #74489 is merged.

r? `@poliorcetics`
  • Loading branch information
Dylan-DPC committed Feb 25, 2021
2 parents 89d32eb + ea3118c commit c9cf922
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 42 deletions.
5 changes: 1 addition & 4 deletions library/core/src/num/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ impl From<!> for TryFromIntError {
///
/// Among other causes, `ParseIntError` can be thrown because of leading or trailing whitespace
/// in the string e.g., when it is obtained from the standard input.
/// Using the [`str.trim()`] method ensures that no whitespace remains before parsing.
///
/// [`str.trim()`]: ../../std/primitive.str.html#method.trim
/// [`i8::from_str_radix`]: ../../std/primitive.i8.html#method.from_str_radix
/// Using the [`str::trim()`] method ensures that no whitespace remains before parsing.
///
/// # Example
///
Expand Down
12 changes: 6 additions & 6 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::mem;
use crate::num::FpCategory;

/// The radix or base of the internal representation of `f32`.
/// Use [`f32::RADIX`](../../std/primitive.f32.html#associatedconstant.RADIX) instead.
/// Use [`f32::RADIX`] instead.
///
/// # Examples
///
Expand Down Expand Up @@ -832,8 +832,8 @@ impl f32 {
/// As the target platform's native endianness is used, portable code
/// should use [`to_be_bytes`] or [`to_le_bytes`], as appropriate, instead.
///
/// [`to_be_bytes`]: #method.to_be_bytes
/// [`to_le_bytes`]: #method.to_le_bytes
/// [`to_be_bytes`]: f32::to_be_bytes
/// [`to_le_bytes`]: f32::to_le_bytes
///
/// # Examples
///
Expand All @@ -860,7 +860,7 @@ impl f32 {
///
/// [`to_ne_bytes`] should be preferred over this whenever possible.
///
/// [`to_ne_bytes`]: #method.to_ne_bytes
/// [`to_ne_bytes`]: f32::to_ne_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -920,8 +920,8 @@ impl f32 {
/// likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as
/// appropriate instead.
///
/// [`from_be_bytes`]: #method.from_be_bytes
/// [`from_le_bytes`]: #method.from_le_bytes
/// [`from_be_bytes`]: f32::from_be_bytes
/// [`from_le_bytes`]: f32::from_le_bytes
///
/// # Examples
///
Expand Down
10 changes: 5 additions & 5 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,8 @@ impl f64 {
/// As the target platform's native endianness is used, portable code
/// should use [`to_be_bytes`] or [`to_le_bytes`], as appropriate, instead.
///
/// [`to_be_bytes`]: #method.to_be_bytes
/// [`to_le_bytes`]: #method.to_le_bytes
/// [`to_be_bytes`]: f64::to_be_bytes
/// [`to_le_bytes`]: f64::to_le_bytes
///
/// # Examples
///
Expand All @@ -874,7 +874,7 @@ impl f64 {
///
/// [`to_ne_bytes`] should be preferred over this whenever possible.
///
/// [`to_ne_bytes`]: #method.to_ne_bytes
/// [`to_ne_bytes`]: f64::to_ne_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -934,8 +934,8 @@ impl f64 {
/// likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as
/// appropriate instead.
///
/// [`from_be_bytes`]: #method.from_be_bytes
/// [`from_le_bytes`]: #method.from_le_bytes
/// [`from_be_bytes`]: f64::from_be_bytes
/// [`from_le_bytes`]: f64::from_le_bytes
///
/// # Examples
///
Expand Down
18 changes: 9 additions & 9 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ macro_rules! int_impl {
///
/// Note that this is *not* the same as a rotate-left; the RHS of a wrapping shift-left is restricted to
/// the range of the type, rather than the bits shifted out of the LHS being returned to the other end.
/// The primitive integer types all implement a [`rotate_left`](#method.rotate_left) function,
/// The primitive integer types all implement a [`rotate_left`](Self::rotate_left) function,
/// which may be what you want instead.
///
/// # Examples
Expand Down Expand Up @@ -1096,7 +1096,7 @@ macro_rules! int_impl {
///
/// Note that this is *not* the same as a rotate-right; the RHS of a wrapping shift-right is restricted
/// to the range of the type, rather than the bits shifted out of the LHS being returned to the other
/// end. The primitive integer types all implement a [`rotate_right`](#method.rotate_right) function,
/// end. The primitive integer types all implement a [`rotate_right`](Self::rotate_right) function,
/// which may be what you want instead.
///
/// # Examples
Expand Down Expand Up @@ -1812,8 +1812,8 @@ macro_rules! int_impl {
///
#[doc = $to_xe_bytes_doc]
///
/// [`to_be_bytes`]: #method.to_be_bytes
/// [`to_le_bytes`]: #method.to_le_bytes
/// [`to_be_bytes`]: Self::to_be_bytes
/// [`to_le_bytes`]: Self::to_le_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -1845,7 +1845,7 @@ macro_rules! int_impl {
///
/// [`to_ne_bytes`] should be preferred over this whenever possible.
///
/// [`to_ne_bytes`]: #method.to_ne_bytes
/// [`to_ne_bytes`]: Self::to_ne_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -1937,8 +1937,8 @@ macro_rules! int_impl {
/// likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as
/// appropriate instead.
///
/// [`from_be_bytes`]: #method.from_be_bytes
/// [`from_le_bytes`]: #method.from_le_bytes
/// [`from_be_bytes`]: Self::from_be_bytes
/// [`from_le_bytes`]: Self::from_le_bytes
///
#[doc = $to_xe_bytes_doc]
///
Expand Down Expand Up @@ -1976,7 +1976,7 @@ macro_rules! int_impl {
}

/// New code should prefer to use
#[doc = concat!("[`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN).")]
#[doc = concat!("[`", stringify!($SelfT), "::MIN", "`] instead.")]
///
/// Returns the smallest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -1989,7 +1989,7 @@ macro_rules! int_impl {
}

/// New code should prefer to use
#[doc = concat!("[`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX).")]
#[doc = concat!("[`", stringify!($SelfT), "::MAX", "`] instead.")]
///
/// Returns the largest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
11 changes: 4 additions & 7 deletions library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl u8 {
/// assert_eq!(65, lowercase_a.to_ascii_uppercase());
/// ```
///
/// [`make_ascii_uppercase`]: #method.make_ascii_uppercase
/// [`make_ascii_uppercase`]: Self::make_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[inline]
pub fn to_ascii_uppercase(&self) -> u8 {
Expand All @@ -216,7 +216,7 @@ impl u8 {
/// assert_eq!(97, uppercase_a.to_ascii_lowercase());
/// ```
///
/// [`make_ascii_lowercase`]: #method.make_ascii_lowercase
/// [`make_ascii_lowercase`]: Self::make_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[inline]
pub fn to_ascii_lowercase(&self) -> u8 {
Expand Down Expand Up @@ -266,7 +266,7 @@ impl u8 {
/// assert_eq!(b'A', byte);
/// ```
///
/// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
/// [`to_ascii_uppercase`]: Self::to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[inline]
pub fn make_ascii_uppercase(&mut self) {
Expand All @@ -291,7 +291,7 @@ impl u8 {
/// assert_eq!(b'a', byte);
/// ```
///
/// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
/// [`to_ascii_lowercase`]: Self::to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[inline]
pub fn make_ascii_lowercase(&mut self) {
Expand Down Expand Up @@ -723,9 +723,6 @@ impl usize {
/// This `enum` is used as the return type for [`f32::classify`] and [`f64::classify`]. See
/// their documentation for more.
///
/// [`f32::classify`]: ../../std/primitive.f32.html#method.classify
/// [`f64::classify`]: ../../std/primitive.f64.html#method.classify
///
/// # Examples
///
/// ```
Expand Down
20 changes: 9 additions & 11 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ macro_rules! uint_impl {
/// RHS of a wrapping shift-left is restricted to the range
/// of the type, rather than the bits shifted out of the LHS
/// being returned to the other end. The primitive integer
/// types all implement a [`rotate_left`](#method.rotate_left) function,
/// types all implement a [`rotate_left`](Self::rotate_left) function,
/// which may be what you want instead.
///
/// # Examples
Expand Down Expand Up @@ -1026,7 +1026,7 @@ macro_rules! uint_impl {
/// RHS of a wrapping shift-right is restricted to the range
/// of the type, rather than the bits shifted out of the LHS
/// being returned to the other end. The primitive integer
/// types all implement a [`rotate_right`](#method.rotate_right) function,
/// types all implement a [`rotate_right`](Self::rotate_right) function,
/// which may be what you want instead.
///
/// # Examples
Expand Down Expand Up @@ -1642,8 +1642,8 @@ macro_rules! uint_impl {
///
#[doc = $to_xe_bytes_doc]
///
/// [`to_be_bytes`]: #method.to_be_bytes
/// [`to_le_bytes`]: #method.to_le_bytes
/// [`to_be_bytes`]: Self::to_be_bytes
/// [`to_le_bytes`]: Self::to_le_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -1675,7 +1675,7 @@ macro_rules! uint_impl {
///
/// [`to_ne_bytes`] should be preferred over this whenever possible.
///
/// [`to_ne_bytes`]: #method.to_ne_bytes
/// [`to_ne_bytes`]: Self::to_ne_bytes
///
/// # Examples
///
Expand Down Expand Up @@ -1767,8 +1767,8 @@ macro_rules! uint_impl {
/// likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as
/// appropriate instead.
///
/// [`from_be_bytes`]: #method.from_be_bytes
/// [`from_le_bytes`]: #method.from_le_bytes
/// [`from_be_bytes`]: Self::from_be_bytes
/// [`from_le_bytes`]: Self::from_le_bytes
///
#[doc = $from_xe_bytes_doc]
///
Expand Down Expand Up @@ -1806,8 +1806,7 @@ macro_rules! uint_impl {
}

/// New code should prefer to use
#[doc = concat!("[`", stringify!($SelfT), "::MIN", "`](#associatedconstant.MIN).")]
/// instead.
#[doc = concat!("[`", stringify!($SelfT), "::MIN", "`] instead.")]
///
/// Returns the smallest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -1818,8 +1817,7 @@ macro_rules! uint_impl {
pub const fn min_value() -> Self { Self::MIN }

/// New code should prefer to use
#[doc = concat!("[`", stringify!($SelfT), "::MAX", "`](#associatedconstant.MAX).")]
/// instead.
#[doc = concat!("[`", stringify!($SelfT), "::MAX", "`] instead.")]
///
/// Returns the largest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down

0 comments on commit c9cf922

Please sign in to comment.