@@ -1198,17 +1198,15 @@ impl<I: ExactSizeIterator> ExactSizeIterator for Peekable<I> {}
1198
1198
impl < I : Iterator > Peekable < I > {
1199
1199
/// Returns a reference to the next() value without advancing the iterator.
1200
1200
///
1201
- /// The `peek()` method will return the value that a call to [`next()`] would
1202
- /// return, but does not advance the iterator. Like [`next()`], if there is
1203
- /// a value, it's wrapped in a `Some(T)`, but if the iterator is over, it
1204
- /// will return `None`.
1201
+ /// Like [`next()`], if there is a value, it is wrapped in a `Some(T)`.
1202
+ /// But if the iteration is over, `None` is returned.
1205
1203
///
1206
1204
/// [`next()`]: trait.Iterator.html#tymethod.next
1207
1205
///
1208
- /// Because `peek()` returns reference, and many iterators iterate over
1209
- /// references, this leads to a possibly confusing situation where the
1206
+ /// Because `peek()` returns a reference, and many iterators iterate over
1207
+ /// references, there can be a possibly confusing situation where the
1210
1208
/// return value is a double reference. You can see this effect in the
1211
- /// examples below, with `&&i32` .
1209
+ /// examples below.
1212
1210
///
1213
1211
/// # Examples
1214
1212
///
@@ -1225,13 +1223,13 @@ impl<I: Iterator> Peekable<I> {
1225
1223
///
1226
1224
/// assert_eq!(iter.next(), Some(&2));
1227
1225
///
1228
- /// // we can peek() multiple times, the iterator won't advance
1226
+ /// // The iterator does not advance even if we `peek` multiple times
1229
1227
/// assert_eq!(iter.peek(), Some(&&3));
1230
1228
/// assert_eq!(iter.peek(), Some(&&3));
1231
1229
///
1232
1230
/// assert_eq!(iter.next(), Some(&3));
1233
1231
///
1234
- /// // after the iterator is finished, so is peek()
1232
+ /// // After the iterator is finished, so is ` peek()`
1235
1233
/// assert_eq!(iter.peek(), None);
1236
1234
/// assert_eq!(iter.next(), None);
1237
1235
/// ```
@@ -1263,10 +1261,10 @@ impl<I: Iterator> Peekable<I> {
1263
1261
///
1264
1262
/// let mut iter = xs.iter().peekable();
1265
1263
///
1266
- /// // there are still elements to iterate over
1264
+ /// // There are still elements to iterate over
1267
1265
/// assert_eq!(iter.is_empty(), false);
1268
1266
///
1269
- /// // let 's consume the iterator
1267
+ /// // Let 's consume the iterator
1270
1268
/// iter.next();
1271
1269
/// iter.next();
1272
1270
/// iter.next();
0 commit comments