@@ -1048,17 +1048,15 @@ impl<I: ExactSizeIterator> ExactSizeIterator for Peekable<I> {}
1048
1048
impl < I : Iterator > Peekable < I > {
1049
1049
/// Returns a reference to the next() value without advancing the iterator.
1050
1050
///
1051
- /// The `peek()` method will return the value that a call to [`next()`] would
1052
- /// return, but does not advance the iterator. Like [`next()`], if there is
1053
- /// a value, it's wrapped in a `Some(T)`, but if the iterator is over, it
1054
- /// will return `None`.
1051
+ /// Like [`next()`], if there is a value, it is wrapped in a `Some(T)`.
1052
+ /// But if the iteration is over, `None` is returned.
1055
1053
///
1056
1054
/// [`next()`]: trait.Iterator.html#tymethod.next
1057
1055
///
1058
- /// Because `peek()` returns reference, and many iterators iterate over
1059
- /// references, this leads to a possibly confusing situation where the
1056
+ /// Because `peek()` returns a reference, and many iterators iterate over
1057
+ /// references, there can be a possibly confusing situation where the
1060
1058
/// return value is a double reference. You can see this effect in the
1061
- /// examples below, with `&&i32` .
1059
+ /// examples below.
1062
1060
///
1063
1061
/// # Examples
1064
1062
///
@@ -1075,13 +1073,13 @@ impl<I: Iterator> Peekable<I> {
1075
1073
///
1076
1074
/// assert_eq!(iter.next(), Some(&2));
1077
1075
///
1078
- /// // we can peek() multiple times, the iterator won't advance
1076
+ /// // The iterator does not advance even if we `peek` multiple times
1079
1077
/// assert_eq!(iter.peek(), Some(&&3));
1080
1078
/// assert_eq!(iter.peek(), Some(&&3));
1081
1079
///
1082
1080
/// assert_eq!(iter.next(), Some(&3));
1083
1081
///
1084
- /// // after the iterator is finished, so is peek()
1082
+ /// // After the iterator is finished, so is ` peek()`
1085
1083
/// assert_eq!(iter.peek(), None);
1086
1084
/// assert_eq!(iter.next(), None);
1087
1085
/// ```
@@ -1113,10 +1111,10 @@ impl<I: Iterator> Peekable<I> {
1113
1111
///
1114
1112
/// let mut iter = xs.iter().peekable();
1115
1113
///
1116
- /// // there are still elements to iterate over
1114
+ /// // There are still elements to iterate over
1117
1115
/// assert_eq!(iter.is_empty(), false);
1118
1116
///
1119
- /// // let 's consume the iterator
1117
+ /// // Let 's consume the iterator
1120
1118
/// iter.next();
1121
1119
/// iter.next();
1122
1120
/// iter.next();
0 commit comments