@@ -1397,7 +1397,7 @@ pub trait Itertools : Iterator {
1397
1397
///
1398
1398
/// The [`.take_while()`][std::iter::Iterator::take_while] adaptor is useful
1399
1399
/// when you want items satisfying a predicate, but to know when to stop
1400
- /// taking elements, we have to consume that last element that doesn't
1400
+ /// taking elements, we have to consume that first element that doesn't
1401
1401
/// satisfy the predicate. This adaptor includes that element where
1402
1402
/// [`.take_while()`][std::iter::Iterator::take_while] would drop it.
1403
1403
///
@@ -1407,7 +1407,6 @@ pub trait Itertools : Iterator {
1407
1407
///
1408
1408
/// ```rust
1409
1409
/// # use itertools::Itertools;
1410
- ///
1411
1410
/// let items = vec![1, 2, 3, 4, 5];
1412
1411
/// let filtered: Vec<_> = items
1413
1412
/// .into_iter()
@@ -1421,18 +1420,20 @@ pub trait Itertools : Iterator {
1421
1420
/// # use itertools::Itertools;
1422
1421
/// let items = vec![1, 2, 3, 4, 5];
1423
1422
///
1424
- /// let take_until_result : Vec<_> = items
1425
- /// .clone ()
1426
- /// .into_iter ()
1423
+ /// let take_while_inclusive_result : Vec<_> = items
1424
+ /// .iter ()
1425
+ /// .copied ()
1427
1426
/// .take_while_inclusive(|&n| n % 3 != 0)
1428
1427
/// .collect();
1429
1428
/// let take_while_result: Vec<_> = items
1430
1429
/// .into_iter()
1431
1430
/// .take_while(|&n| n % 3 != 0)
1432
1431
/// .collect();
1433
1432
///
1434
- /// assert_eq!(take_until_result , vec![1, 2, 3]);
1433
+ /// assert_eq!(take_while_inclusive_result , vec![1, 2, 3]);
1435
1434
/// assert_eq!(take_while_result, vec![1, 2]);
1435
+ /// // both iterators have the same items remaining at this point---the 3
1436
+ /// // is lost from the `take_while` vec
1436
1437
/// ```
1437
1438
///
1438
1439
/// ```rust
@@ -2763,7 +2764,6 @@ pub trait Itertools : Iterator {
2763
2764
/// itertools::assert_equal(oldest_people_first,
2764
2765
/// vec!["Jill", "Jack", "Jane", "John"]);
2765
2766
/// ```
2766
- /// ```
2767
2767
#[ cfg( feature = "use_alloc" ) ]
2768
2768
fn sorted_by_cached_key < K , F > ( self , f : F ) -> VecIntoIter < Self :: Item >
2769
2769
where
0 commit comments