Skip to content

Commit 07cd4c8

Browse files
committed
Use intra-doc links
1 parent 118860a commit 07cd4c8

File tree

1 file changed

+35
-50
lines changed

1 file changed

+35
-50
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
2222
/// generally, please see the [module-level documentation]. In particular, you
2323
/// may want to know how to [implement `Iterator`][impl].
2424
///
25-
/// [module-level documentation]: index.html
26-
/// [impl]: index.html#implementing-iterator
25+
/// [module-level documentation]: crate::iter
26+
/// [impl]: crate::iter#implementing-iterator
2727
#[stable(feature = "rust1", since = "1.0.0")]
2828
#[rustc_on_unimplemented(
2929
on(
@@ -107,8 +107,6 @@ pub trait Iterator {
107107
/// again may or may not eventually start returning [`Some(Item)`] again at some
108108
/// point.
109109
///
110-
/// [`Some(Item)`]: Some
111-
///
112110
/// # Examples
113111
///
114112
/// Basic usage:
@@ -212,7 +210,7 @@ pub trait Iterator {
212210
/// returning the number of times it saw [`Some`]. Note that [`next`] has to be
213211
/// called at least once even if the iterator does not have any elements.
214212
///
215-
/// [`next`]: #tymethod.next
213+
/// [`next`]: Iterator::next
216214
///
217215
/// # Overflow Behavior
218216
///
@@ -449,9 +447,7 @@ pub trait Iterator {
449447
/// }
450448
/// ```
451449
///
452-
/// [`once`]: fn.once.html
453-
/// [`Iterator`]: trait.Iterator.html
454-
/// [`IntoIterator`]: trait.IntoIterator.html
450+
/// [`once`]: crate::iter::once
455451
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
456452
#[inline]
457453
#[stable(feature = "rust1", since = "1.0.0")]
@@ -496,9 +492,6 @@ pub trait Iterator {
496492
/// [`Iterator`] itself. For example, slices (`&[T]`) implement
497493
/// [`IntoIterator`], and so can be passed to `zip()` directly:
498494
///
499-
/// [`IntoIterator`]: trait.IntoIterator.html
500-
/// [`Iterator`]: trait.Iterator.html
501-
///
502495
/// ```
503496
/// let s1 = &[1, 2, 3];
504497
/// let s2 = &[4, 5, 6];
@@ -530,8 +523,8 @@ pub trait Iterator {
530523
/// assert_eq!((2, 'o'), zipper[2]);
531524
/// ```
532525
///
533-
/// [`enumerate`]: #method.enumerate
534-
/// [`next`]: #tymethod.next
526+
/// [`enumerate`]: Iterator::enumerate
527+
/// [`next`]: Iterator::next
535528
#[inline]
536529
#[stable(feature = "rust1", since = "1.0.0")]
537530
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
@@ -734,8 +727,8 @@ pub trait Iterator {
734727
/// Why `filter_map` and not just [`filter`] and [`map`]? The key is in this
735728
/// part:
736729
///
737-
/// [`filter`]: #method.filter
738-
/// [`map`]: #method.map
730+
/// [`filter`]: Iterator::filter
731+
/// [`map`]: Iterator::map
739732
///
740733
/// > If the closure returns [`Some(element)`][`Some`], then that element is returned.
741734
///
@@ -767,7 +760,6 @@ pub trait Iterator {
767760
/// assert_eq!(iter.next(), None);
768761
/// ```
769762
///
770-
/// [`Option<T>`]: Option
771763
#[inline]
772764
#[stable(feature = "rust1", since = "1.0.0")]
773765
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
@@ -802,7 +794,7 @@ pub trait Iterator {
802794
///
803795
/// [`usize`]: type@usize
804796
/// [`usize::MAX`]: crate::usize::MAX
805-
/// [`zip`]: #method.zip
797+
/// [`zip`]: Iterator::zip
806798
///
807799
/// # Examples
808800
///
@@ -837,8 +829,8 @@ pub trait Iterator {
837829
/// anything other than fetching the next value) of the [`next`] method
838830
/// will occur.
839831
///
840-
/// [`peek`]: crate::iter::Peekable::peek
841-
/// [`next`]: #tymethod.next
832+
/// [`peek`]: Peekable::peek
833+
/// [`next`]: Iterator::next
842834
///
843835
/// # Examples
844836
///
@@ -876,7 +868,7 @@ pub trait Iterator {
876868

877869
/// Creates an iterator that [`skip`]s elements based on a predicate.
878870
///
879-
/// [`skip`]: #method.skip
871+
/// [`skip`]: Iterator::skip
880872
///
881873
/// `skip_while()` takes a closure as an argument. It will call this
882874
/// closure on each element of the iterator, and ignore elements
@@ -1043,8 +1035,8 @@ pub trait Iterator {
10431035
///
10441036
/// Here's the same example, but with [`take_while`] and [`map`]:
10451037
///
1046-
/// [`take_while`]: #method.take_while
1047-
/// [`map`]: #method.map
1038+
/// [`take_while`]: Iterator::take_while
1039+
/// [`map`]: Iterator::map
10481040
///
10491041
/// ```
10501042
/// let a = [-1i32, 4, 0, 1];
@@ -1104,7 +1096,7 @@ pub trait Iterator {
11041096
/// It is also not specified what this iterator returns after the first` None` is returned.
11051097
/// If you need fused iterator, use [`fuse`].
11061098
///
1107-
/// [`fuse`]: #method.fuse
1099+
/// [`fuse`]: Iterator::fuse
11081100
#[inline]
11091101
#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")]
11101102
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
@@ -1190,7 +1182,7 @@ pub trait Iterator {
11901182
/// An iterator adaptor similar to [`fold`] that holds internal state and
11911183
/// produces a new iterator.
11921184
///
1193-
/// [`fold`]: #method.fold
1185+
/// [`fold`]: Iterator::fold
11941186
///
11951187
/// `scan()` takes two arguments: an initial value which seeds the internal
11961188
/// state, and a closure with two arguments, the first being a mutable
@@ -1246,8 +1238,8 @@ pub trait Iterator {
12461238
/// one item for each element, and `flat_map()`'s closure returns an
12471239
/// iterator for each element.
12481240
///
1249-
/// [`map`]: #method.map
1250-
/// [`flatten`]: #method.flatten
1241+
/// [`map`]: Iterator::map
1242+
/// [`flatten`]: Iterator::flatten
12511243
///
12521244
/// # Examples
12531245
///
@@ -1333,7 +1325,7 @@ pub trait Iterator {
13331325
/// two-dimensional and not one-dimensional. To get a one-dimensional
13341326
/// structure, you have to `flatten()` again.
13351327
///
1336-
/// [`flat_map()`]: #method.flat_map
1328+
/// [`flat_map()`]: Iterator::flat_map
13371329
#[inline]
13381330
#[stable(feature = "iterator_flatten", since = "1.29.0")]
13391331
fn flatten(self) -> Flatten<Self>
@@ -1350,8 +1342,6 @@ pub trait Iterator {
13501342
/// [`Some(T)`] again. `fuse()` adapts an iterator, ensuring that after a
13511343
/// [`None`] is given, it will always return [`None`] forever.
13521344
///
1353-
/// [`Some(T)`]: Some
1354-
///
13551345
/// # Examples
13561346
///
13571347
/// Basic usage:
@@ -1640,7 +1630,7 @@ pub trait Iterator {
16401630
/// assert_eq!(Ok(vec![1, 3]), result);
16411631
/// ```
16421632
///
1643-
/// [`iter`]: #tymethod.next
1633+
/// [`iter`]: Iterator::next
16441634
/// [`String`]: ../../std/string/struct.String.html
16451635
/// [`char`]: type@char
16461636
#[inline]
@@ -1661,8 +1651,8 @@ pub trait Iterator {
16611651
///
16621652
/// See also [`is_partitioned()`] and [`partition_in_place()`].
16631653
///
1664-
/// [`is_partitioned()`]: #method.is_partitioned
1665-
/// [`partition_in_place()`]: #method.partition_in_place
1654+
/// [`is_partitioned()`]: Iterator::is_partitioned
1655+
/// [`partition_in_place()`]: Iterator::partition_in_place
16661656
///
16671657
/// # Examples
16681658
///
@@ -1716,8 +1706,8 @@ pub trait Iterator {
17161706
///
17171707
/// See also [`is_partitioned()`] and [`partition()`].
17181708
///
1719-
/// [`is_partitioned()`]: #method.is_partitioned
1720-
/// [`partition()`]: #method.partition
1709+
/// [`is_partitioned()`]: Iterator::is_partitioned
1710+
/// [`partition()`]: Iterator::partition
17211711
///
17221712
/// # Examples
17231713
///
@@ -1779,8 +1769,8 @@ pub trait Iterator {
17791769
///
17801770
/// See also [`partition()`] and [`partition_in_place()`].
17811771
///
1782-
/// [`partition()`]: #method.partition
1783-
/// [`partition_in_place()`]: #method.partition_in_place
1772+
/// [`partition()`]: Iterator::partition
1773+
/// [`partition_in_place()`]: Iterator::partition_in_place
17841774
///
17851775
/// # Examples
17861776
///
@@ -1879,8 +1869,8 @@ pub trait Iterator {
18791869
/// This can also be thought of as the fallible form of [`for_each()`]
18801870
/// or as the stateless version of [`try_fold()`].
18811871
///
1882-
/// [`for_each()`]: #method.for_each
1883-
/// [`try_fold()`]: #method.try_fold
1872+
/// [`for_each()`]: Iterator::for_each
1873+
/// [`try_fold()`]: Iterator::try_fold
18841874
///
18851875
/// # Examples
18861876
///
@@ -2006,11 +1996,13 @@ pub trait Iterator {
20061996
accum
20071997
}
20081998

2009-
/// The same as [`fold()`](#method.fold), but uses the first element in the
1999+
/// The same as [`fold()`], but uses the first element in the
20102000
/// iterator as the initial value, folding every subsequent element into it.
20112001
/// If the iterator is empty, return `None`; otherwise, return the result
20122002
/// of the fold.
20132003
///
2004+
/// [`fold()`]: Iterator::fold
2005+
///
20142006
/// # Example
20152007
///
20162008
/// Find the maximum value:
@@ -2165,8 +2157,6 @@ pub trait Iterator {
21652157
/// argument is a double reference. You can see this effect in the
21662158
/// examples below, with `&&x`.
21672159
///
2168-
/// [`Some(element)`]: Some
2169-
///
21702160
/// # Examples
21712161
///
21722162
/// Basic usage:
@@ -2311,7 +2301,6 @@ pub trait Iterator {
23112301
/// This function might panic if the iterator has more than `usize::MAX`
23122302
/// non-matching elements.
23132303
///
2314-
/// [`Some(index)`]: Some
23152304
/// [`usize::MAX`]: crate::usize::MAX
23162305
///
23172306
/// # Examples
@@ -2373,8 +2362,6 @@ pub trait Iterator {
23732362
/// `rposition()` is short-circuiting; in other words, it will stop
23742363
/// processing as soon as it finds a `true`.
23752364
///
2376-
/// [`Some(index)`]: Some
2377-
///
23782365
/// # Examples
23792366
///
23802367
/// Basic usage:
@@ -2602,8 +2589,6 @@ pub trait Iterator {
26022589
/// This is only possible if the iterator has an end, so `rev()` only
26032590
/// works on [`DoubleEndedIterator`]s.
26042591
///
2605-
/// [`DoubleEndedIterator`]: trait.DoubleEndedIterator.html
2606-
///
26072592
/// # Examples
26082593
///
26092594
/// ```
@@ -2634,7 +2619,7 @@ pub trait Iterator {
26342619
///
26352620
/// This function is, in some sense, the opposite of [`zip`].
26362621
///
2637-
/// [`zip`]: #method.zip
2622+
/// [`zip`]: Iterator::zip
26382623
///
26392624
/// # Examples
26402625
///
@@ -2713,7 +2698,7 @@ pub trait Iterator {
27132698
/// This is useful when you have an iterator over `&T`, but you need an
27142699
/// iterator over `T`.
27152700
///
2716-
/// [`clone`]: crate::clone::Clone::clone
2701+
/// [`clone`]: Clone::clone
27172702
///
27182703
/// # Examples
27192704
///
@@ -3197,7 +3182,7 @@ pub trait Iterator {
31973182
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
31983183
/// ```
31993184
///
3200-
/// [`is_sorted`]: #method.is_sorted
3185+
/// [`is_sorted`]: Iterator::is_sorted
32013186
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
32023187
fn is_sorted_by<F>(mut self, mut compare: F) -> bool
32033188
where
@@ -3226,7 +3211,7 @@ pub trait Iterator {
32263211
/// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see
32273212
/// its documentation for more information.
32283213
///
3229-
/// [`is_sorted`]: #method.is_sorted
3214+
/// [`is_sorted`]: Iterator::is_sorted
32303215
///
32313216
/// # Examples
32323217
///

0 commit comments

Comments
 (0)