Use intra-doc link on Iterator page

This commit is contained in:
Lzu Tao 2020-07-13 15:50:30 +00:00
parent c2dbebd3d4
commit 91738d804a
1 changed files with 21 additions and 56 deletions

View File

@ -106,8 +106,7 @@ pub trait Iterator {
/// again may or may not eventually start returning [`Some(Item)`] again at some /// again may or may not eventually start returning [`Some(Item)`] again at some
/// point. /// point.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`Some(Item)`]: Some
/// [`Some(Item)`]: ../../std/option/enum.Option.html#variant.Some
/// ///
/// # Examples /// # Examples
/// ///
@ -160,9 +159,7 @@ pub trait Iterator {
/// The default implementation returns `(0, `[`None`]`)` which is correct for any /// The default implementation returns `(0, `[`None`]`)` which is correct for any
/// iterator. /// iterator.
/// ///
/// [`usize`]: ../../std/primitive.usize.html /// [`usize`]: type@usize
/// [`Option`]: ../../std/option/enum.Option.html
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples
/// ///
@ -214,8 +211,6 @@ pub trait Iterator {
/// called at least once even if the iterator does not have any elements. /// called at least once even if the iterator does not have any elements.
/// ///
/// [`next`]: #tymethod.next /// [`next`]: #tymethod.next
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`Some`]: ../../std/option/enum.Option.html#variant.Some
/// ///
/// # Overflow Behavior /// # Overflow Behavior
/// ///
@ -229,7 +224,7 @@ pub trait Iterator {
/// This function might panic if the iterator has more than [`usize::MAX`] /// This function might panic if the iterator has more than [`usize::MAX`]
/// elements. /// elements.
/// ///
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html /// [`usize::MAX`]: crate::usize::MAX
/// ///
/// # Examples /// # Examples
/// ///
@ -263,8 +258,6 @@ pub trait Iterator {
/// doing so, it keeps track of the current element. After [`None`] is /// doing so, it keeps track of the current element. After [`None`] is
/// returned, `last()` will then return the last element it saw. /// returned, `last()` will then return the last element it saw.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -303,8 +296,6 @@ pub trait Iterator {
/// `nth()` will return [`None`] if `n` is greater than or equal to the length of the /// `nth()` will return [`None`] if `n` is greater than or equal to the length of the
/// iterator. /// iterator.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -537,9 +528,8 @@ pub trait Iterator {
/// assert_eq!((2, 'o'), zipper[2]); /// assert_eq!((2, 'o'), zipper[2]);
/// ``` /// ```
/// ///
/// [`enumerate`]: trait.Iterator.html#method.enumerate /// [`enumerate`]: #method.enumerate
/// [`next`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`next`]: #tymethod.next
/// [`None`]: ../../std/option/enum.Option.html#variant.None
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
@ -568,7 +558,7 @@ pub trait Iterator {
/// more idiomatic to use [`for`] than `map()`. /// more idiomatic to use [`for`] than `map()`.
/// ///
/// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for
/// [`FnMut`]: ../../std/ops/trait.FnMut.html /// [`FnMut`]: crate::ops::FnMut
/// ///
/// # Examples /// # Examples
/// ///
@ -777,9 +767,7 @@ pub trait Iterator {
/// assert_eq!(iter.next(), None); /// assert_eq!(iter.next(), None);
/// ``` /// ```
/// ///
/// [`Option<T>`]: ../../std/option/enum.Option.html /// [`Option<T>`]: Option
/// [`Some`]: ../../std/option/enum.Option.html#variant.Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
@ -812,8 +800,8 @@ pub trait Iterator {
/// The returned iterator might panic if the to-be-returned index would /// The returned iterator might panic if the to-be-returned index would
/// overflow a [`usize`]. /// overflow a [`usize`].
/// ///
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html /// [`usize`]: type@usize
/// [`usize`]: ../../std/primitive.usize.html /// [`usize::MAX`]: crate::usize::MAX
/// [`zip`]: #method.zip /// [`zip`]: #method.zip
/// ///
/// # Examples /// # Examples
@ -849,8 +837,8 @@ pub trait Iterator {
/// anything other than fetching the next value) of the [`next`] method /// anything other than fetching the next value) of the [`next`] method
/// will occur. /// will occur.
/// ///
/// [`peek`]: struct.Peekable.html#method.peek /// [`peek`]: crate::iter::Peekable::peek
/// [`next`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`next`]: #tymethod.next
/// ///
/// # Examples /// # Examples
/// ///
@ -1116,8 +1104,6 @@ pub trait Iterator {
/// It is also not specified what this iterator returns after the first` None` is returned. /// It is also not specified what this iterator returns after the first` None` is returned.
/// If you need fused iterator, use [`fuse`]. /// If you need fused iterator, use [`fuse`].
/// ///
/// [`Some`]: ../../std/option/enum.Option.html#variant.Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`fuse`]: #method.fuse /// [`fuse`]: #method.fuse
#[inline] #[inline]
#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")] #[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")]
@ -1216,8 +1202,6 @@ pub trait Iterator {
/// iterator and the return value from the closure, an [`Option`], is /// iterator and the return value from the closure, an [`Option`], is
/// yielded by the iterator. /// yielded by the iterator.
/// ///
/// [`Option`]: ../../std/option/enum.Option.html
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -1366,8 +1350,7 @@ pub trait Iterator {
/// [`Some(T)`] again. `fuse()` adapts an iterator, ensuring that after a /// [`Some(T)`] again. `fuse()` adapts an iterator, ensuring that after a
/// [`None`] is given, it will always return [`None`] forever. /// [`None`] is given, it will always return [`None`] forever.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`Some(T)`]: Some
/// [`Some(T)`]: ../../std/option/enum.Option.html#variant.Some
/// ///
/// # Examples /// # Examples
/// ///
@ -1658,10 +1641,9 @@ pub trait Iterator {
/// assert_eq!(Ok(vec![1, 3]), result); /// assert_eq!(Ok(vec![1, 3]), result);
/// ``` /// ```
/// ///
/// [`iter`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`iter`]: #tymethod.next
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`char`]: ../../std/primitive.char.html /// [`char`]: type@char
/// [`Result`]: ../../std/result/enum.Result.html
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"] #[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead"]
@ -2184,8 +2166,7 @@ pub trait Iterator {
/// argument is a double reference. You can see this effect in the /// argument is a double reference. You can see this effect in the
/// examples below, with `&&x`. /// examples below, with `&&x`.
/// ///
/// [`Some(element)`]: ../../std/option/enum.Option.html#variant.Some /// [`Some(element)`]: Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples
/// ///
@ -2331,9 +2312,8 @@ pub trait Iterator {
/// This function might panic if the iterator has more than `usize::MAX` /// This function might panic if the iterator has more than `usize::MAX`
/// non-matching elements. /// non-matching elements.
/// ///
/// [`Some(index)`]: ../../std/option/enum.Option.html#variant.Some /// [`Some(index)`]: Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`usize::MAX`]: crate::usize::MAX
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html
/// ///
/// # Examples /// # Examples
/// ///
@ -2394,8 +2374,7 @@ pub trait Iterator {
/// `rposition()` is short-circuiting; in other words, it will stop /// `rposition()` is short-circuiting; in other words, it will stop
/// processing as soon as it finds a `true`. /// processing as soon as it finds a `true`.
/// ///
/// [`Some(index)`]: ../../std/option/enum.Option.html#variant.Some /// [`Some(index)`]: Some
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples
/// ///
@ -2449,8 +2428,6 @@ pub trait Iterator {
/// If several elements are equally maximum, the last element is /// If several elements are equally maximum, the last element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -2477,8 +2454,6 @@ pub trait Iterator {
/// If several elements are equally minimum, the first element is /// If several elements are equally minimum, the first element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -2506,8 +2481,6 @@ pub trait Iterator {
/// If several elements are equally maximum, the last element is /// If several elements are equally maximum, the last element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -2541,8 +2514,6 @@ pub trait Iterator {
/// If several elements are equally maximum, the last element is /// If several elements are equally maximum, the last element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -2570,8 +2541,6 @@ pub trait Iterator {
/// If several elements are equally minimum, the first element is /// If several elements are equally minimum, the first element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -2605,8 +2574,6 @@ pub trait Iterator {
/// If several elements are equally minimum, the first element is /// If several elements are equally minimum, the first element is
/// returned. If the iterator is empty, [`None`] is returned. /// returned. If the iterator is empty, [`None`] is returned.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -2747,7 +2714,7 @@ pub trait Iterator {
/// This is useful when you have an iterator over `&T`, but you need an /// This is useful when you have an iterator over `&T`, but you need an
/// iterator over `T`. /// iterator over `T`.
/// ///
/// [`clone`]: ../../std/clone/trait.Clone.html#tymethod.clone /// [`clone`]: crate::clone::Clone::clone
/// ///
/// # Examples /// # Examples
/// ///
@ -2779,8 +2746,6 @@ pub trait Iterator {
/// from the beginning. After iterating again, it will start at the /// from the beginning. After iterating again, it will start at the
/// beginning again. And again. And again. Forever. /// beginning again. And again. And again. Forever.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
///
/// # Examples /// # Examples
/// ///
/// Basic usage: /// Basic usage:
@ -3233,7 +3198,7 @@ pub trait Iterator {
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b))); /// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
/// ``` /// ```
/// ///
/// [`is_sorted`]: trait.Iterator.html#method.is_sorted /// [`is_sorted`]: #method.is_sorted
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
fn is_sorted_by<F>(mut self, mut compare: F) -> bool fn is_sorted_by<F>(mut self, mut compare: F) -> bool
where where
@ -3262,7 +3227,7 @@ pub trait Iterator {
/// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see /// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see
/// its documentation for more information. /// its documentation for more information.
/// ///
/// [`is_sorted`]: trait.Iterator.html#method.is_sorted /// [`is_sorted`]: #method.is_sorted
/// ///
/// # Examples /// # Examples
/// ///