1
Fork 0

Remove excessive linking

This commit is contained in:
patrick-gu 2021-09-03 17:09:37 -07:00
parent 5719d22125
commit 911d0cbe80
4 changed files with 53 additions and 58 deletions

View file

@ -310,9 +310,9 @@ impl<T, const N: usize> [T; N] {
/// on large arrays or check the emitted code. Also try to avoid chained /// on large arrays or check the emitted code. Also try to avoid chained
/// maps (e.g. `arr.map(...).map(...)`). /// maps (e.g. `arr.map(...).map(...)`).
/// ///
/// In many cases, you can instead use [`Iterator::map`] by calling [`.iter()`](slice::iter) /// In many cases, you can instead use [`Iterator::map`] by calling `.iter()`
/// or [`.into_iter()`](IntoIterator::into_iter) on your array. `[T; N]::map` is only necessary /// or `.into_iter()` on your array. `[T; N]::map` is only necessary if you
/// if you really need a new array of the same size as the result. Rust's lazy /// really need a new array of the same size as the result. Rust's lazy
/// iterators tend to get optimized very well. /// iterators tend to get optimized very well.
/// ///
/// ///

View file

@ -2,7 +2,7 @@
#[lang = "bool"] #[lang = "bool"]
impl bool { impl bool {
/// Returns <code>[Some]\(t)</code> if the `bool` is [`true`](keyword.true.html), or [`None`] otherwise. /// Returns `Some(t)` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
/// ///
/// # Examples /// # Examples
/// ///
@ -18,7 +18,7 @@ impl bool {
if self { Some(t) } else { None } if self { Some(t) } else { None }
} }
/// Returns <code>[Some]\(f())</code> if the `bool` is [`true`](keyword.true.html), or [`None`] otherwise. /// Returns `Some` if the `bool` is [`true`](keyword.true.html), or `None` otherwise.
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -29,11 +29,11 @@ impl char {
pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}'; pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';
/// The version of [Unicode](https://www.unicode.org/) that the Unicode parts of /// The version of [Unicode](https://www.unicode.org/) that the Unicode parts of
/// `char` and [`str`] methods are based on. /// `char` and `str` methods are based on.
/// ///
/// New versions of Unicode are released regularly and subsequently all methods /// New versions of Unicode are released regularly and subsequently all methods
/// in the standard library depending on Unicode are updated. Therefore the /// in the standard library depending on Unicode are updated. Therefore the
/// behavior of some `char` and [`str`] methods and the value of this constant /// behavior of some `char` and `str` methods and the value of this constant
/// changes over time. This is *not* considered to be a breaking change. /// changes over time. This is *not* considered to be a breaking change.
/// ///
/// The version numbering scheme is explained in /// The version numbering scheme is explained in
@ -42,7 +42,7 @@ impl char {
pub const UNICODE_VERSION: (u8, u8, u8) = crate::unicode::UNICODE_VERSION; pub const UNICODE_VERSION: (u8, u8, u8) = crate::unicode::UNICODE_VERSION;
/// Creates an iterator over the UTF-16 encoded code points in `iter`, /// Creates an iterator over the UTF-16 encoded code points in `iter`,
/// returning unpaired surrogates as [`Err`]s. /// returning unpaired surrogates as `Err`s.
/// ///
/// # Examples /// # Examples
/// ///
@ -70,7 +70,7 @@ impl char {
/// ); /// );
/// ``` /// ```
/// ///
/// A lossy decoder can be obtained by replacing [`Err`] results with the replacement character: /// A lossy decoder can be obtained by replacing `Err` results with the replacement character:
/// ///
/// ``` /// ```
/// use std::char::{decode_utf16, REPLACEMENT_CHARACTER}; /// use std::char::{decode_utf16, REPLACEMENT_CHARACTER};
@ -93,7 +93,7 @@ impl char {
super::decode::decode_utf16(iter) super::decode::decode_utf16(iter)
} }
/// Converts a [`u32`] to a `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`](keyword.as.html): /// [`as`](keyword.as.html):
@ -106,7 +106,7 @@ impl char {
/// ``` /// ```
/// ///
/// However, the reverse is not true: not all valid [`u32`]s are valid /// 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 /// `char`s. `from_u32()` will return `None` if the input is not a valid value
/// for a `char`. /// for a `char`.
/// ///
/// For an unsafe version of this function which ignores these checks, see /// For an unsafe version of this function which ignores these checks, see
@ -126,7 +126,7 @@ impl char {
/// assert_eq!(Some('❤'), c); /// 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; /// use std::char;
@ -141,7 +141,7 @@ impl char {
super::convert::from_u32(i) super::convert::from_u32(i)
} }
/// Converts a [`u32`] to a `char`, ignoring validity. /// 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`: /// `as`:
@ -190,7 +190,7 @@ impl char {
/// sixteen, hexadecimal, to give some common values. Arbitrary /// sixteen, hexadecimal, to give some common values. Arbitrary
/// radices are supported. /// radices are supported.
/// ///
/// `from_digit()` will return [`None`] if the input is not a digit in /// `from_digit()` will return `None` if the input is not a digit in
/// the given radix. /// the given radix.
/// ///
/// # Panics /// # Panics
@ -214,7 +214,7 @@ impl char {
/// assert_eq!(Some('b'), c); /// assert_eq!(Some('b'), c);
/// ``` /// ```
/// ///
/// Returning [`None`] when the input is not a digit: /// Returning `None` when the input is not a digit:
/// ///
/// ``` /// ```
/// use std::char; /// use std::char;
@ -299,7 +299,7 @@ impl char {
/// ///
/// # Errors /// # Errors
/// ///
/// Returns [`None`] if the `char` does not refer to a digit in the given radix. /// Returns `None` if the `char` does not refer to a digit in the given radix.
/// ///
/// # Panics /// # Panics
/// ///
@ -360,7 +360,7 @@ impl char {
/// println!(); /// println!();
/// ``` /// ```
/// ///
/// Using [`println!`](macro.println.html) directly: /// Using `println! directly:
/// ///
/// ``` /// ```
/// println!("{}", '❤'.escape_unicode()); /// println!("{}", '❤'.escape_unicode());
@ -423,7 +423,7 @@ impl char {
/// as `char`s. /// as `char`s.
/// ///
/// This will escape the characters similar to the [`Debug`](core::fmt::Debug) implementations /// This will escape the characters similar to the [`Debug`](core::fmt::Debug) implementations
/// of [`str`] or `char`. /// of `str` or `char`.
/// ///
/// # Examples /// # Examples
/// ///
@ -436,7 +436,7 @@ impl char {
/// println!(); /// println!();
/// ``` /// ```
/// ///
/// Using [`println!`](macro.println.html) directly: /// Using `println!` directly:
/// ///
/// ``` /// ```
/// println!("{}", '\n'.escape_debug()); /// println!("{}", '\n'.escape_debug());
@ -490,7 +490,7 @@ impl char {
/// println!(); /// println!();
/// ``` /// ```
/// ///
/// Using [`println!`](macro.println.html) directly: /// Using `println!` directly:
/// ///
/// ``` /// ```
/// println!("{}", '"'.escape_default()); /// println!("{}", '"'.escape_default());
@ -543,9 +543,8 @@ impl char {
/// assert_eq!(len, 4); /// assert_eq!(len, 4);
/// ``` /// ```
/// ///
/// The <code>[&](reference)[str]</code> type guarantees that its contents are UTF-8, /// The `&str` type guarantees that its contents are UTF-8, and so we can compare the length it
/// and so we can compare the length it would take if each code point was represented /// would take if each code point was represented as a `char` vs in the `&str` itself:
/// as a `char` vs in the <code>[&](reference)[str]</code> itself:
/// ///
/// ``` /// ```
/// // as chars /// // as chars
@ -638,7 +637,7 @@ impl char {
unsafe { from_utf8_unchecked_mut(encode_utf8_raw(self as u32, dst)) } unsafe { from_utf8_unchecked_mut(encode_utf8_raw(self as u32, dst)) }
} }
/// Encodes this character as UTF-16 into the provided [`u16`] buffer, /// Encodes this character as UTF-16 into the provided `u16` buffer,
/// and then returns the subslice of the buffer that contains the encoded character. /// and then returns the subslice of the buffer that contains the encoded character.
/// ///
/// # Panics /// # Panics
@ -648,7 +647,7 @@ impl char {
/// ///
/// # Examples /// # Examples
/// ///
/// In both of these examples, '𝕊' takes two [`u16`]s to encode. /// In both of these examples, '𝕊' takes two `u16`s to encode.
/// ///
/// ``` /// ```
/// let mut b = [0; 2]; /// let mut b = [0; 2];
@ -672,7 +671,7 @@ impl char {
encode_utf16_raw(self as u32, dst) encode_utf16_raw(self as u32, dst)
} }
/// Returns [`true`](keyword.true.html) if this `char` has the `Alphabetic` property. /// Returns `true` if this `char` has the `Alphabetic` property.
/// ///
/// `Alphabetic` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and /// `Alphabetic` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@ -702,7 +701,7 @@ impl char {
} }
} }
/// Returns [`true`](keyword.true.html) if this `char` has the `Lowercase` property. /// Returns `true` if this `char` has the `Lowercase` property.
/// ///
/// `Lowercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and /// `Lowercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@ -734,7 +733,7 @@ impl char {
} }
} }
/// Returns [`true`](keyword.true.html) if this `char` has the `Uppercase` property. /// Returns `true` if this `char` has the `Uppercase` property.
/// ///
/// `Uppercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and /// `Uppercase` is described in Chapter 4 (Character Properties) of the [Unicode Standard] and
/// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`]. /// specified in the [Unicode Character Database][ucd] [`DerivedCoreProperties.txt`].
@ -766,7 +765,7 @@ impl char {
} }
} }
/// Returns [`true`](keyword.true.html) if this `char` has the `White_Space` property. /// Returns `true` if this `char` has the `White_Space` property.
/// ///
/// `White_Space` is specified in the [Unicode Character Database][ucd] [`PropList.txt`]. /// `White_Space` is specified in the [Unicode Character Database][ucd] [`PropList.txt`].
/// ///
@ -794,8 +793,7 @@ impl char {
} }
} }
/// Returns [`true`](keyword.true.html) if this `char` satisfies either /// Returns `true` if this `char` satisfies either [`is_alphabetic()`] or [`is_numeric()`].
/// [`is_alphabetic()`] or [`is_numeric()`].
/// ///
/// [`is_alphabetic()`]: #method.is_alphabetic /// [`is_alphabetic()`]: #method.is_alphabetic
/// [`is_numeric()`]: #method.is_numeric /// [`is_numeric()`]: #method.is_numeric
@ -820,7 +818,7 @@ impl char {
self.is_alphabetic() || self.is_numeric() self.is_alphabetic() || self.is_numeric()
} }
/// Returns [`true`](keyword.true.html) if this `char` has the general category for control codes. /// Returns `true` if this `char` has the general category for control codes.
/// ///
/// Control codes (code points with the general category of `Cc`) are described in Chapter 4 /// Control codes (code points with the general category of `Cc`) are described in Chapter 4
/// (Character Properties) of the [Unicode Standard] and specified in the [Unicode Character /// (Character Properties) of the [Unicode Standard] and specified in the [Unicode Character
@ -845,7 +843,7 @@ impl char {
unicode::Cc(self) unicode::Cc(self)
} }
/// Returns [`true`](keyword.true.html) if this `char` has the `Grapheme_Extend` property. /// Returns `true` if this `char` has the `Grapheme_Extend` property.
/// ///
/// `Grapheme_Extend` is described in [Unicode Standard Annex #29 (Unicode Text /// `Grapheme_Extend` is described in [Unicode Standard Annex #29 (Unicode Text
/// Segmentation)][uax29] and specified in the [Unicode Character Database][ucd] /// Segmentation)][uax29] and specified in the [Unicode Character Database][ucd]
@ -859,7 +857,7 @@ impl char {
unicode::Grapheme_Extend(self) unicode::Grapheme_Extend(self)
} }
/// Returns [`true`](keyword.true.html) if this `char` has one of the general categories for numbers. /// Returns `true` if this `char` has one of the general categories for numbers.
/// ///
/// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric /// The general categories for numbers (`Nd` for decimal digits, `Nl` for letter-like numeric
/// characters, and `No` for other numeric characters) are specified in the [Unicode Character /// characters, and `No` for other numeric characters) are specified in the [Unicode Character
@ -927,7 +925,7 @@ impl char {
/// println!(); /// println!();
/// ``` /// ```
/// ///
/// Using [`println!`](macro.println.html) directly: /// Using `println!` directly:
/// ///
/// ``` /// ```
/// println!("{}", 'İ'.to_lowercase()); /// println!("{}", 'İ'.to_lowercase());
@ -992,7 +990,7 @@ impl char {
/// println!(); /// println!();
/// ``` /// ```
/// ///
/// Using [`println!`](macro.println.html) directly: /// Using `println!` directly:
/// ///
/// ``` /// ```
/// println!("{}", 'ß'.to_uppercase()); /// println!("{}", 'ß'.to_uppercase());

View file

@ -578,10 +578,10 @@ mod prim_pointer {}
/// # Editions /// # Editions
/// ///
/// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call /// Prior to Rust 1.53, arrays did not implement [`IntoIterator`] by value, so the method call
/// <code>array.[into_iter()]</code> auto-referenced into a slice iterator. /// `array.into_iter()` auto-referenced into a [slice iterator](slice::iter). Right now, the old behavior
/// Right now, the old behavior is preserved in the 2015 and 2018 editions of Rust for /// is preserved in the 2015 and 2018 editions of Rust for compatibility, ignoring
/// compatibility, ignoring [`IntoIterator`] by value. In the future, the behavior on the 2015 and /// `IntoIterator` by value. In the future, the behavior on the 2015 and 2018 edition
/// 2018 edition might be made consistent to the behavior of later editions. /// might be made consistent to the behavior of later editions.
/// ///
/// ```rust,edition2018 /// ```rust,edition2018
/// # #![allow(array_into_iter)] // override our `deny(warnings)` /// # #![allow(array_into_iter)] // override our `deny(warnings)`
@ -607,9 +607,8 @@ mod prim_pointer {}
/// } /// }
/// ``` /// ```
/// ///
/// Starting in the 2021 edition, <code>array.[into_iter()]</code> will use [`IntoIterator`] /// Starting in the 2021 edition, `array.into_iter()` will use `IntoIterator` normally to iterate
/// normally to iterate by value, and [`iter()`](slice::iter) should be used to iterate by /// by value, and `iter()` should be used to iterate by reference like previous editions.
/// reference like previous editions.
/// ///
/// ```rust,edition2021,ignore /// ```rust,edition2021,ignore
/// # // FIXME: ignored because 2021 testing is still unstable /// # // FIXME: ignored because 2021 testing is still unstable
@ -628,16 +627,16 @@ mod prim_pointer {}
/// } /// }
/// ``` /// ```
/// ///
/// Future language versions might start treating the <code>array.[into_iter()]</code> /// Future language versions might start treating the `array.into_iter()`
/// syntax on editions 2015 and 2018 the same as on edition 2021. So code using /// syntax on editions 2015 and 2018 the same as on edition 2021. So code using
/// those older editions should still be written with this change in mind, to /// those older editions should still be written with this change in mind, to
/// prevent breakage in the future. The safest way to accomplish this is to /// prevent breakage in the future. The safest way to accomplish this is to
/// avoid the [`into_iter`](IntoIterator::into_iter) syntax on those editions. /// avoid the `into_iter` syntax on those editions. If an edition update is not
/// If an edition update is not viable/desired, there are multiple alternatives: /// viable/desired, there are multiple alternatives:
/// * use [`iter`](slice::iter), equivalent to the old behavior, creating references /// * use `iter`, equivalent to the old behavior, creating references
/// * use [`array::IntoIter`], equivalent to the post-2021 behavior (Rust 1.51+) /// * use [`array::IntoIter`], equivalent to the post-2021 behavior (Rust 1.51+)
/// * replace <code>[for] ... [in] array.[into_iter()] {</code>` with /// * replace `for ... in array.into_iter() {` with `for ... in array {`,
/// <code>[for] ... [in] array {</code>, equivalent to the post-2021 behavior (Rust 1.53+) /// equivalent to the post-2021 behavior (Rust 1.53+)
/// ///
/// ```rust,edition2018 /// ```rust,edition2018
/// use std::array::IntoIter; /// use std::array::IntoIter;
@ -676,9 +675,6 @@ mod prim_pointer {}
/// [`Borrow`]: borrow::Borrow /// [`Borrow`]: borrow::Borrow
/// [`BorrowMut`]: borrow::BorrowMut /// [`BorrowMut`]: borrow::BorrowMut
/// [slice pattern]: ../reference/patterns.html#slice-patterns /// [slice pattern]: ../reference/patterns.html#slice-patterns
/// [into_iter()]: IntoIterator::into_iter
/// [for]: keyword.for.html
/// [in]: keyword.in.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
mod prim_array {} mod prim_array {}
@ -1097,7 +1093,7 @@ mod prim_usize {}
/// The following traits are implemented for all `&T`, regardless of the type of its referent: /// The following traits are implemented for all `&T`, regardless of the type of its referent:
/// ///
/// * [`Copy`] /// * [`Copy`]
/// * [`Clone`] \(Note that this will not defer to `T`'s [`Clone`] implementation if it exists!) /// * [`Clone`] \(Note that this will not defer to `T`'s `Clone` implementation if it exists!)
/// * [`Deref`] /// * [`Deref`]
/// * [`Borrow`] /// * [`Borrow`]
/// * [`Pointer`] /// * [`Pointer`]
@ -1106,7 +1102,7 @@ mod prim_usize {}
/// [`Borrow`]: borrow::Borrow /// [`Borrow`]: borrow::Borrow
/// [`Pointer`]: fmt::Pointer /// [`Pointer`]: fmt::Pointer
/// ///
/// `&mut T` references get all of the above except [`Copy`] and [`Clone`] (to prevent creating /// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
/// multiple simultaneous mutable borrows), plus the following, regardless of the type of its /// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
/// referent: /// referent:
/// ///
@ -1134,18 +1130,18 @@ mod prim_usize {}
/// [`Hash`]: hash::Hash /// [`Hash`]: hash::Hash
/// [`ToSocketAddrs`]: net::ToSocketAddrs /// [`ToSocketAddrs`]: net::ToSocketAddrs
/// ///
/// `&mut T` references get all of the above except [`ToSocketAddrs`], plus the following, if `T` /// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
/// implements that trait: /// implements that trait:
/// ///
/// * [`AsMut`] /// * [`AsMut`]
/// * [`FnMut`] \(in addition, `&mut T` references get [`FnOnce`] if <code>T: [FnMut]</code>) /// * [`FnMut`] \(in addition, `&mut T` references get [`FnOnce`] if `T: FnMut`)
/// * [`fmt::Write`] /// * [`fmt::Write`]
/// * [`Iterator`] /// * [`Iterator`]
/// * [`DoubleEndedIterator`] /// * [`DoubleEndedIterator`]
/// * [`ExactSizeIterator`] /// * [`ExactSizeIterator`]
/// * [`FusedIterator`] /// * [`FusedIterator`]
/// * [`TrustedLen`] /// * [`TrustedLen`]
/// * [`Send`] \(note that `&T` references only get [`Send`] if <code>T: [Sync]</code>) /// * [`Send`] \(note that `&T` references only get `Send` if <code>T: [Sync]</code>)
/// * [`io::Write`] /// * [`io::Write`]
/// * [`Read`] /// * [`Read`]
/// * [`Seek`] /// * [`Seek`]
@ -1177,7 +1173,8 @@ mod prim_ref {}
/// Function pointers are pointers that point to *code*, not data. They can be called /// Function pointers are pointers that point to *code*, not data. They can be called
/// just like functions. Like references, function pointers are, among other things, assumed to /// just like functions. Like references, function pointers are, among other things, assumed to
/// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null /// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null
/// pointers, make your type <code>[Option]\<fn()></code> with your required signature. /// pointers, make your type [`Option<fn()>`](core::option#options-and-pointers-nullable-pointers)
/// with your required signature.
/// ///
/// ### Safety /// ### Safety
/// ///