@@ -1397,7 +1397,7 @@ pub trait Itertools : Iterator {
13971397 ///
13981398 /// The [`.take_while()`][std::iter::Iterator::take_while] adaptor is useful
13991399 /// 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
14011401 /// satisfy the predicate. This adaptor includes that element where
14021402 /// [`.take_while()`][std::iter::Iterator::take_while] would drop it.
14031403 ///
@@ -1407,7 +1407,6 @@ pub trait Itertools : Iterator {
14071407 ///
14081408 /// ```rust
14091409 /// # use itertools::Itertools;
1410- ///
14111410 /// let items = vec![1, 2, 3, 4, 5];
14121411 /// let filtered: Vec<_> = items
14131412 /// .into_iter()
@@ -1421,18 +1420,20 @@ pub trait Itertools : Iterator {
14211420 /// # use itertools::Itertools;
14221421 /// let items = vec![1, 2, 3, 4, 5];
14231422 ///
1424- /// let take_until_result : Vec<_> = items
1425- /// .clone ()
1426- /// .into_iter ()
1423+ /// let take_while_inclusive_result : Vec<_> = items
1424+ /// .iter ()
1425+ /// .copied ()
14271426 /// .take_while_inclusive(|&n| n % 3 != 0)
14281427 /// .collect();
14291428 /// let take_while_result: Vec<_> = items
14301429 /// .into_iter()
14311430 /// .take_while(|&n| n % 3 != 0)
14321431 /// .collect();
14331432 ///
1434- /// assert_eq!(take_until_result , vec![1, 2, 3]);
1433+ /// assert_eq!(take_while_inclusive_result , vec![1, 2, 3]);
14351434 /// 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
14361437 /// ```
14371438 ///
14381439 /// ```rust
@@ -2763,7 +2764,6 @@ pub trait Itertools : Iterator {
27632764 /// itertools::assert_equal(oldest_people_first,
27642765 /// vec!["Jill", "Jack", "Jane", "John"]);
27652766 /// ```
2766- /// ```
27672767 #[ cfg( feature = "use_alloc" ) ]
27682768 fn sorted_by_cached_key < K , F > ( self , f : F ) -> VecIntoIter < Self :: Item >
27692769 where
0 commit comments