Skip to content

Commit 4918ed9

Browse files
authored
Rollup merge of #76238 - denisvasilik:intra-doc-links-core-iterator, r=jyn514
Move to intra-doc links for library/core/src/iter/traits/iterator.rs Helps with #75080. @jyn514 We're almost finished with this issue. Thanks for mentoring. If you have other topics to work on just let me know, I will be around in Discord. @rustbot modify labels: T-doc, A-intra-doc-links Known issues: * Link from `core` to `std` (#74481): [`OsStr`] [`String`] [`VecDeque<T>`]
2 parents d059f26 + 89e7fb3 commit 4918ed9

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

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

+35-40
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
2121
/// generally, please see the [module-level documentation]. In particular, you
2222
/// may want to know how to [implement `Iterator`][impl].
2323
///
24-
/// [module-level documentation]: index.html
25-
/// [impl]: index.html#implementing-iterator
24+
/// [module-level documentation]: crate::iter
25+
/// [impl]: crate::iter#implementing-iterator
2626
#[stable(feature = "rust1", since = "1.0.0")]
2727
#[rustc_on_unimplemented(
2828
on(
@@ -211,7 +211,7 @@ pub trait Iterator {
211211
/// returning the number of times it saw [`Some`]. Note that [`next`] has to be
212212
/// called at least once even if the iterator does not have any elements.
213213
///
214-
/// [`next`]: #tymethod.next
214+
/// [`next`]: Iterator::next
215215
///
216216
/// # Overflow Behavior
217217
///
@@ -448,9 +448,7 @@ pub trait Iterator {
448448
/// }
449449
/// ```
450450
///
451-
/// [`once`]: fn.once.html
452-
/// [`Iterator`]: trait.Iterator.html
453-
/// [`IntoIterator`]: trait.IntoIterator.html
451+
/// [`once`]: crate::iter::once
454452
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
455453
#[inline]
456454
#[stable(feature = "rust1", since = "1.0.0")]
@@ -495,9 +493,6 @@ pub trait Iterator {
495493
/// [`Iterator`] itself. For example, slices (`&[T]`) implement
496494
/// [`IntoIterator`], and so can be passed to `zip()` directly:
497495
///
498-
/// [`IntoIterator`]: trait.IntoIterator.html
499-
/// [`Iterator`]: trait.Iterator.html
500-
///
501496
/// ```
502497
/// let s1 = &[1, 2, 3];
503498
/// let s2 = &[4, 5, 6];
@@ -529,8 +524,8 @@ pub trait Iterator {
529524
/// assert_eq!((2, 'o'), zipper[2]);
530525
/// ```
531526
///
532-
/// [`enumerate`]: #method.enumerate
533-
/// [`next`]: #tymethod.next
527+
/// [`enumerate`]: Iterator::enumerate
528+
/// [`next`]: Iterator::next
534529
#[inline]
535530
#[stable(feature = "rust1", since = "1.0.0")]
536531
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
@@ -733,8 +728,8 @@ pub trait Iterator {
733728
/// Why `filter_map` and not just [`filter`] and [`map`]? The key is in this
734729
/// part:
735730
///
736-
/// [`filter`]: #method.filter
737-
/// [`map`]: #method.map
731+
/// [`filter`]: Iterator::filter
732+
/// [`map`]: Iterator::map
738733
///
739734
/// > If the closure returns [`Some(element)`][`Some`], then that element is returned.
740735
///
@@ -801,7 +796,7 @@ pub trait Iterator {
801796
///
802797
/// [`usize`]: type@usize
803798
/// [`usize::MAX`]: crate::usize::MAX
804-
/// [`zip`]: #method.zip
799+
/// [`zip`]: Iterator::zip
805800
///
806801
/// # Examples
807802
///
@@ -836,8 +831,8 @@ pub trait Iterator {
836831
/// anything other than fetching the next value) of the [`next`] method
837832
/// will occur.
838833
///
839-
/// [`peek`]: crate::iter::Peekable::peek
840-
/// [`next`]: #tymethod.next
834+
/// [`peek`]: Peekable::peek
835+
/// [`next`]: Iterator::next
841836
///
842837
/// # Examples
843838
///
@@ -875,7 +870,7 @@ pub trait Iterator {
875870

876871
/// Creates an iterator that [`skip`]s elements based on a predicate.
877872
///
878-
/// [`skip`]: #method.skip
873+
/// [`skip`]: Iterator::skip
879874
///
880875
/// `skip_while()` takes a closure as an argument. It will call this
881876
/// closure on each element of the iterator, and ignore elements
@@ -1042,8 +1037,8 @@ pub trait Iterator {
10421037
///
10431038
/// Here's the same example, but with [`take_while`] and [`map`]:
10441039
///
1045-
/// [`take_while`]: #method.take_while
1046-
/// [`map`]: #method.map
1040+
/// [`take_while`]: Iterator::take_while
1041+
/// [`map`]: Iterator::map
10471042
///
10481043
/// ```
10491044
/// let a = [-1i32, 4, 0, 1];
@@ -1103,7 +1098,7 @@ pub trait Iterator {
11031098
/// It is also not specified what this iterator returns after the first` None` is returned.
11041099
/// If you need fused iterator, use [`fuse`].
11051100
///
1106-
/// [`fuse`]: #method.fuse
1101+
/// [`fuse`]: Iterator::fuse
11071102
#[inline]
11081103
#[unstable(feature = "iter_map_while", reason = "recently added", issue = "68537")]
11091104
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
@@ -1189,7 +1184,7 @@ pub trait Iterator {
11891184
/// An iterator adaptor similar to [`fold`] that holds internal state and
11901185
/// produces a new iterator.
11911186
///
1192-
/// [`fold`]: #method.fold
1187+
/// [`fold`]: Iterator::fold
11931188
///
11941189
/// `scan()` takes two arguments: an initial value which seeds the internal
11951190
/// state, and a closure with two arguments, the first being a mutable
@@ -1245,8 +1240,8 @@ pub trait Iterator {
12451240
/// one item for each element, and `flat_map()`'s closure returns an
12461241
/// iterator for each element.
12471242
///
1248-
/// [`map`]: #method.map
1249-
/// [`flatten`]: #method.flatten
1243+
/// [`map`]: Iterator::map
1244+
/// [`flatten`]: Iterator::flatten
12501245
///
12511246
/// # Examples
12521247
///
@@ -1332,7 +1327,7 @@ pub trait Iterator {
13321327
/// two-dimensional and not one-dimensional. To get a one-dimensional
13331328
/// structure, you have to `flatten()` again.
13341329
///
1335-
/// [`flat_map()`]: #method.flat_map
1330+
/// [`flat_map()`]: Iterator::flat_map
13361331
#[inline]
13371332
#[stable(feature = "iterator_flatten", since = "1.29.0")]
13381333
fn flatten(self) -> Flatten<Self>
@@ -1639,7 +1634,7 @@ pub trait Iterator {
16391634
/// assert_eq!(Ok(vec![1, 3]), result);
16401635
/// ```
16411636
///
1642-
/// [`iter`]: #tymethod.next
1637+
/// [`iter`]: Iterator::next
16431638
/// [`String`]: ../../std/string/struct.String.html
16441639
/// [`char`]: type@char
16451640
#[inline]
@@ -1660,8 +1655,8 @@ pub trait Iterator {
16601655
///
16611656
/// See also [`is_partitioned()`] and [`partition_in_place()`].
16621657
///
1663-
/// [`is_partitioned()`]: #method.is_partitioned
1664-
/// [`partition_in_place()`]: #method.partition_in_place
1658+
/// [`is_partitioned()`]: Iterator::is_partitioned
1659+
/// [`partition_in_place()`]: Iterator::partition_in_place
16651660
///
16661661
/// # Examples
16671662
///
@@ -1715,8 +1710,8 @@ pub trait Iterator {
17151710
///
17161711
/// See also [`is_partitioned()`] and [`partition()`].
17171712
///
1718-
/// [`is_partitioned()`]: #method.is_partitioned
1719-
/// [`partition()`]: #method.partition
1713+
/// [`is_partitioned()`]: Iterator::is_partitioned
1714+
/// [`partition()`]: Iterator::partition
17201715
///
17211716
/// # Examples
17221717
///
@@ -1778,8 +1773,8 @@ pub trait Iterator {
17781773
///
17791774
/// See also [`partition()`] and [`partition_in_place()`].
17801775
///
1781-
/// [`partition()`]: #method.partition
1782-
/// [`partition_in_place()`]: #method.partition_in_place
1776+
/// [`partition()`]: Iterator::partition
1777+
/// [`partition_in_place()`]: Iterator::partition_in_place
17831778
///
17841779
/// # Examples
17851780
///
@@ -1878,8 +1873,8 @@ pub trait Iterator {
18781873
/// This can also be thought of as the fallible form of [`for_each()`]
18791874
/// or as the stateless version of [`try_fold()`].
18801875
///
1881-
/// [`for_each()`]: #method.for_each
1882-
/// [`try_fold()`]: #method.try_fold
1876+
/// [`for_each()`]: Iterator::for_each
1877+
/// [`try_fold()`]: Iterator::try_fold
18831878
///
18841879
/// # Examples
18851880
///
@@ -2005,11 +2000,13 @@ pub trait Iterator {
20052000
accum
20062001
}
20072002

2008-
/// The same as [`fold()`](#method.fold), but uses the first element in the
2003+
/// The same as [`fold()`], but uses the first element in the
20092004
/// iterator as the initial value, folding every subsequent element into it.
20102005
/// If the iterator is empty, return `None`; otherwise, return the result
20112006
/// of the fold.
20122007
///
2008+
/// [`fold()`]: Iterator::fold
2009+
///
20132010
/// # Example
20142011
///
20152012
/// Find the maximum value:
@@ -2607,8 +2604,6 @@ pub trait Iterator {
26072604
/// This is only possible if the iterator has an end, so `rev()` only
26082605
/// works on [`DoubleEndedIterator`]s.
26092606
///
2610-
/// [`DoubleEndedIterator`]: trait.DoubleEndedIterator.html
2611-
///
26122607
/// # Examples
26132608
///
26142609
/// ```
@@ -2639,7 +2634,7 @@ pub trait Iterator {
26392634
///
26402635
/// This function is, in some sense, the opposite of [`zip`].
26412636
///
2642-
/// [`zip`]: #method.zip
2637+
/// [`zip`]: Iterator::zip
26432638
///
26442639
/// # Examples
26452640
///
@@ -2718,7 +2713,7 @@ pub trait Iterator {
27182713
/// This is useful when you have an iterator over `&T`, but you need an
27192714
/// iterator over `T`.
27202715
///
2721-
/// [`clone`]: crate::clone::Clone::clone
2716+
/// [`clone`]: Clone::clone
27222717
///
27232718
/// # Examples
27242719
///
@@ -3206,7 +3201,7 @@ pub trait Iterator {
32063201
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
32073202
/// ```
32083203
///
3209-
/// [`is_sorted`]: #method.is_sorted
3204+
/// [`is_sorted`]: Iterator::is_sorted
32103205
#[unstable(feature = "is_sorted", reason = "new API", issue = "53485")]
32113206
fn is_sorted_by<F>(mut self, mut compare: F) -> bool
32123207
where
@@ -3235,7 +3230,7 @@ pub trait Iterator {
32353230
/// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see
32363231
/// its documentation for more information.
32373232
///
3238-
/// [`is_sorted`]: #method.is_sorted
3233+
/// [`is_sorted`]: Iterator::is_sorted
32393234
///
32403235
/// # Examples
32413236
///

0 commit comments

Comments
 (0)