File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 50
50
}
51
51
52
52
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
53
- ( 0 , self . inner . size_hint ( ) . 1 )
53
+ let min = self . last . as_ref ( ) . map ( |_| 1 ) . unwrap_or ( 0 ) ;
54
+ let max = self . inner . size_hint ( ) . 1 ;
55
+ ( min, max)
54
56
}
55
57
}
56
58
@@ -105,7 +107,9 @@ where
105
107
}
106
108
107
109
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
108
- ( 0 , self . inner . size_hint ( ) . 1 )
110
+ let min = self . last . as_ref ( ) . map ( |_| 1 ) . unwrap_or ( 0 ) ;
111
+ let max = self . inner . size_hint ( ) . 1 ;
112
+ ( min, max)
109
113
}
110
114
}
111
115
@@ -161,6 +165,8 @@ where
161
165
}
162
166
163
167
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
164
- ( 0 , self . inner . size_hint ( ) . 1 )
168
+ let min = self . last . as_ref ( ) . map ( |_| 1 ) . unwrap_or ( 0 ) ;
169
+ let max = self . inner . size_hint ( ) . 1 ;
170
+ ( min, max)
165
171
}
166
172
}
Original file line number Diff line number Diff line change @@ -1693,6 +1693,9 @@ pub trait Iterator {
1693
1693
/// Removes all but the first of consecutive elements in the iterator according to the
1694
1694
/// [`PartialEq`] trait implementation.
1695
1695
///
1696
+ /// For an iterator yielding infinitely many consecutive duplicates,
1697
+ /// this may result in an infinite loop.
1698
+ ///
1696
1699
/// If the iterator is sorted, this removes all duplicates.
1697
1700
///
1698
1701
/// # Examples
@@ -1726,6 +1729,9 @@ pub trait Iterator {
1726
1729
/// The `same_bucket` function is passed a references to two elements from the iterator and
1727
1730
/// must determine if the elements compare equal.
1728
1731
///
1732
+ /// For an iterator yielding infinitely many consecutive duplicates,
1733
+ /// this may result in an infinite loop.
1734
+ ///
1729
1735
/// If the iterator is sorted, this removes all duplicates.
1730
1736
///
1731
1737
/// # Examples
@@ -1756,6 +1762,9 @@ pub trait Iterator {
1756
1762
/// Removes all but the first of consecutive elements in the iterator that
1757
1763
/// resolve to the same key.
1758
1764
///
1765
+ /// For an iterator yielding infinitely many consecutive duplicates,
1766
+ /// this may result in an infinite loop.
1767
+ ///
1759
1768
/// If the iterator is sorted, this removes all duplicates.
1760
1769
///
1761
1770
/// # Examples
You can’t perform that action at this time.
0 commit comments