@@ -22,8 +22,8 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
22
22
/// generally, please see the [module-level documentation]. In particular, you
23
23
/// may want to know how to [implement `Iterator`][impl].
24
24
///
25
- /// [module-level documentation]: index.html
26
- /// [impl]: index.html #implementing-iterator
25
+ /// [module-level documentation]: crate::iter
26
+ /// [impl]: crate::iter #implementing-iterator
27
27
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
28
28
#[ rustc_on_unimplemented(
29
29
on(
@@ -107,8 +107,6 @@ pub trait Iterator {
107
107
/// again may or may not eventually start returning [`Some(Item)`] again at some
108
108
/// point.
109
109
///
110
- /// [`Some(Item)`]: Some
111
- ///
112
110
/// # Examples
113
111
///
114
112
/// Basic usage:
@@ -212,7 +210,7 @@ pub trait Iterator {
212
210
/// returning the number of times it saw [`Some`]. Note that [`next`] has to be
213
211
/// called at least once even if the iterator does not have any elements.
214
212
///
215
- /// [`next`]: #tymethod. next
213
+ /// [`next`]: Iterator:: next
216
214
///
217
215
/// # Overflow Behavior
218
216
///
@@ -449,9 +447,7 @@ pub trait Iterator {
449
447
/// }
450
448
/// ```
451
449
///
452
- /// [`once`]: fn.once.html
453
- /// [`Iterator`]: trait.Iterator.html
454
- /// [`IntoIterator`]: trait.IntoIterator.html
450
+ /// [`once`]: crate::iter::once
455
451
/// [`OsStr`]: ../../std/ffi/struct.OsStr.html
456
452
#[ inline]
457
453
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -496,9 +492,6 @@ pub trait Iterator {
496
492
/// [`Iterator`] itself. For example, slices (`&[T]`) implement
497
493
/// [`IntoIterator`], and so can be passed to `zip()` directly:
498
494
///
499
- /// [`IntoIterator`]: trait.IntoIterator.html
500
- /// [`Iterator`]: trait.Iterator.html
501
- ///
502
495
/// ```
503
496
/// let s1 = &[1, 2, 3];
504
497
/// let s2 = &[4, 5, 6];
@@ -530,8 +523,8 @@ pub trait Iterator {
530
523
/// assert_eq!((2, 'o'), zipper[2]);
531
524
/// ```
532
525
///
533
- /// [`enumerate`]: #method. enumerate
534
- /// [`next`]: #tymethod. next
526
+ /// [`enumerate`]: Iterator:: enumerate
527
+ /// [`next`]: Iterator:: next
535
528
#[ inline]
536
529
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
537
530
fn zip < U > ( self , other : U ) -> Zip < Self , U :: IntoIter >
@@ -734,8 +727,8 @@ pub trait Iterator {
734
727
/// Why `filter_map` and not just [`filter`] and [`map`]? The key is in this
735
728
/// part:
736
729
///
737
- /// [`filter`]: #method. filter
738
- /// [`map`]: #method. map
730
+ /// [`filter`]: Iterator:: filter
731
+ /// [`map`]: Iterator:: map
739
732
///
740
733
/// > If the closure returns [`Some(element)`][`Some`], then that element is returned.
741
734
///
@@ -767,7 +760,6 @@ pub trait Iterator {
767
760
/// assert_eq!(iter.next(), None);
768
761
/// ```
769
762
///
770
- /// [`Option<T>`]: Option
771
763
#[ inline]
772
764
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
773
765
fn filter_map < B , F > ( self , f : F ) -> FilterMap < Self , F >
@@ -802,7 +794,7 @@ pub trait Iterator {
802
794
///
803
795
/// [`usize`]: type@usize
804
796
/// [`usize::MAX`]: crate::usize::MAX
805
- /// [`zip`]: #method. zip
797
+ /// [`zip`]: Iterator:: zip
806
798
///
807
799
/// # Examples
808
800
///
@@ -837,8 +829,8 @@ pub trait Iterator {
837
829
/// anything other than fetching the next value) of the [`next`] method
838
830
/// will occur.
839
831
///
840
- /// [`peek`]: crate::iter:: Peekable::peek
841
- /// [`next`]: #tymethod. next
832
+ /// [`peek`]: Peekable::peek
833
+ /// [`next`]: Iterator:: next
842
834
///
843
835
/// # Examples
844
836
///
@@ -876,7 +868,7 @@ pub trait Iterator {
876
868
877
869
/// Creates an iterator that [`skip`]s elements based on a predicate.
878
870
///
879
- /// [`skip`]: #method. skip
871
+ /// [`skip`]: Iterator:: skip
880
872
///
881
873
/// `skip_while()` takes a closure as an argument. It will call this
882
874
/// closure on each element of the iterator, and ignore elements
@@ -1043,8 +1035,8 @@ pub trait Iterator {
1043
1035
///
1044
1036
/// Here's the same example, but with [`take_while`] and [`map`]:
1045
1037
///
1046
- /// [`take_while`]: #method. take_while
1047
- /// [`map`]: #method. map
1038
+ /// [`take_while`]: Iterator:: take_while
1039
+ /// [`map`]: Iterator:: map
1048
1040
///
1049
1041
/// ```
1050
1042
/// let a = [-1i32, 4, 0, 1];
@@ -1104,7 +1096,7 @@ pub trait Iterator {
1104
1096
/// It is also not specified what this iterator returns after the first` None` is returned.
1105
1097
/// If you need fused iterator, use [`fuse`].
1106
1098
///
1107
- /// [`fuse`]: #method. fuse
1099
+ /// [`fuse`]: Iterator:: fuse
1108
1100
#[ inline]
1109
1101
#[ unstable( feature = "iter_map_while" , reason = "recently added" , issue = "68537" ) ]
1110
1102
fn map_while < B , P > ( self , predicate : P ) -> MapWhile < Self , P >
@@ -1190,7 +1182,7 @@ pub trait Iterator {
1190
1182
/// An iterator adaptor similar to [`fold`] that holds internal state and
1191
1183
/// produces a new iterator.
1192
1184
///
1193
- /// [`fold`]: #method. fold
1185
+ /// [`fold`]: Iterator:: fold
1194
1186
///
1195
1187
/// `scan()` takes two arguments: an initial value which seeds the internal
1196
1188
/// state, and a closure with two arguments, the first being a mutable
@@ -1246,8 +1238,8 @@ pub trait Iterator {
1246
1238
/// one item for each element, and `flat_map()`'s closure returns an
1247
1239
/// iterator for each element.
1248
1240
///
1249
- /// [`map`]: #method. map
1250
- /// [`flatten`]: #method. flatten
1241
+ /// [`map`]: Iterator:: map
1242
+ /// [`flatten`]: Iterator:: flatten
1251
1243
///
1252
1244
/// # Examples
1253
1245
///
@@ -1333,7 +1325,7 @@ pub trait Iterator {
1333
1325
/// two-dimensional and not one-dimensional. To get a one-dimensional
1334
1326
/// structure, you have to `flatten()` again.
1335
1327
///
1336
- /// [`flat_map()`]: #method. flat_map
1328
+ /// [`flat_map()`]: Iterator:: flat_map
1337
1329
#[ inline]
1338
1330
#[ stable( feature = "iterator_flatten" , since = "1.29.0" ) ]
1339
1331
fn flatten ( self ) -> Flatten < Self >
@@ -1350,8 +1342,6 @@ pub trait Iterator {
1350
1342
/// [`Some(T)`] again. `fuse()` adapts an iterator, ensuring that after a
1351
1343
/// [`None`] is given, it will always return [`None`] forever.
1352
1344
///
1353
- /// [`Some(T)`]: Some
1354
- ///
1355
1345
/// # Examples
1356
1346
///
1357
1347
/// Basic usage:
@@ -1640,7 +1630,7 @@ pub trait Iterator {
1640
1630
/// assert_eq!(Ok(vec![1, 3]), result);
1641
1631
/// ```
1642
1632
///
1643
- /// [`iter`]: #tymethod. next
1633
+ /// [`iter`]: Iterator:: next
1644
1634
/// [`String`]: ../../std/string/struct.String.html
1645
1635
/// [`char`]: type@char
1646
1636
#[ inline]
@@ -1661,8 +1651,8 @@ pub trait Iterator {
1661
1651
///
1662
1652
/// See also [`is_partitioned()`] and [`partition_in_place()`].
1663
1653
///
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
1666
1656
///
1667
1657
/// # Examples
1668
1658
///
@@ -1716,8 +1706,8 @@ pub trait Iterator {
1716
1706
///
1717
1707
/// See also [`is_partitioned()`] and [`partition()`].
1718
1708
///
1719
- /// [`is_partitioned()`]: #method. is_partitioned
1720
- /// [`partition()`]: #method. partition
1709
+ /// [`is_partitioned()`]: Iterator:: is_partitioned
1710
+ /// [`partition()`]: Iterator:: partition
1721
1711
///
1722
1712
/// # Examples
1723
1713
///
@@ -1779,8 +1769,8 @@ pub trait Iterator {
1779
1769
///
1780
1770
/// See also [`partition()`] and [`partition_in_place()`].
1781
1771
///
1782
- /// [`partition()`]: #method. partition
1783
- /// [`partition_in_place()`]: #method. partition_in_place
1772
+ /// [`partition()`]: Iterator:: partition
1773
+ /// [`partition_in_place()`]: Iterator:: partition_in_place
1784
1774
///
1785
1775
/// # Examples
1786
1776
///
@@ -1879,8 +1869,8 @@ pub trait Iterator {
1879
1869
/// This can also be thought of as the fallible form of [`for_each()`]
1880
1870
/// or as the stateless version of [`try_fold()`].
1881
1871
///
1882
- /// [`for_each()`]: #method. for_each
1883
- /// [`try_fold()`]: #method. try_fold
1872
+ /// [`for_each()`]: Iterator:: for_each
1873
+ /// [`try_fold()`]: Iterator:: try_fold
1884
1874
///
1885
1875
/// # Examples
1886
1876
///
@@ -2006,11 +1996,13 @@ pub trait Iterator {
2006
1996
accum
2007
1997
}
2008
1998
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
2010
2000
/// iterator as the initial value, folding every subsequent element into it.
2011
2001
/// If the iterator is empty, return `None`; otherwise, return the result
2012
2002
/// of the fold.
2013
2003
///
2004
+ /// [`fold()`]: Iterator::fold
2005
+ ///
2014
2006
/// # Example
2015
2007
///
2016
2008
/// Find the maximum value:
@@ -2165,8 +2157,6 @@ pub trait Iterator {
2165
2157
/// argument is a double reference. You can see this effect in the
2166
2158
/// examples below, with `&&x`.
2167
2159
///
2168
- /// [`Some(element)`]: Some
2169
- ///
2170
2160
/// # Examples
2171
2161
///
2172
2162
/// Basic usage:
@@ -2311,7 +2301,6 @@ pub trait Iterator {
2311
2301
/// This function might panic if the iterator has more than `usize::MAX`
2312
2302
/// non-matching elements.
2313
2303
///
2314
- /// [`Some(index)`]: Some
2315
2304
/// [`usize::MAX`]: crate::usize::MAX
2316
2305
///
2317
2306
/// # Examples
@@ -2373,8 +2362,6 @@ pub trait Iterator {
2373
2362
/// `rposition()` is short-circuiting; in other words, it will stop
2374
2363
/// processing as soon as it finds a `true`.
2375
2364
///
2376
- /// [`Some(index)`]: Some
2377
- ///
2378
2365
/// # Examples
2379
2366
///
2380
2367
/// Basic usage:
@@ -2602,8 +2589,6 @@ pub trait Iterator {
2602
2589
/// This is only possible if the iterator has an end, so `rev()` only
2603
2590
/// works on [`DoubleEndedIterator`]s.
2604
2591
///
2605
- /// [`DoubleEndedIterator`]: trait.DoubleEndedIterator.html
2606
- ///
2607
2592
/// # Examples
2608
2593
///
2609
2594
/// ```
@@ -2634,7 +2619,7 @@ pub trait Iterator {
2634
2619
///
2635
2620
/// This function is, in some sense, the opposite of [`zip`].
2636
2621
///
2637
- /// [`zip`]: #method. zip
2622
+ /// [`zip`]: Iterator:: zip
2638
2623
///
2639
2624
/// # Examples
2640
2625
///
@@ -2713,7 +2698,7 @@ pub trait Iterator {
2713
2698
/// This is useful when you have an iterator over `&T`, but you need an
2714
2699
/// iterator over `T`.
2715
2700
///
2716
- /// [`clone`]: crate::clone:: Clone::clone
2701
+ /// [`clone`]: Clone::clone
2717
2702
///
2718
2703
/// # Examples
2719
2704
///
@@ -3197,7 +3182,7 @@ pub trait Iterator {
3197
3182
/// assert!(![0.0, 1.0, f32::NAN].iter().is_sorted_by(|a, b| a.partial_cmp(b)));
3198
3183
/// ```
3199
3184
///
3200
- /// [`is_sorted`]: #method. is_sorted
3185
+ /// [`is_sorted`]: Iterator:: is_sorted
3201
3186
#[ unstable( feature = "is_sorted" , reason = "new API" , issue = "53485" ) ]
3202
3187
fn is_sorted_by < F > ( mut self , mut compare : F ) -> bool
3203
3188
where
@@ -3226,7 +3211,7 @@ pub trait Iterator {
3226
3211
/// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see
3227
3212
/// its documentation for more information.
3228
3213
///
3229
- /// [`is_sorted`]: #method. is_sorted
3214
+ /// [`is_sorted`]: Iterator:: is_sorted
3230
3215
///
3231
3216
/// # Examples
3232
3217
///
0 commit comments