@@ -1618,35 +1618,20 @@ pub trait Itertools : Iterator {
1618
1618
/// ```
1619
1619
/// use itertools::Itertools;
1620
1620
///
1621
- /// let data = vec![
1622
- /// "foo".to_owned(),
1623
- /// "bar".to_owned(),
1624
- /// "baz".to_owned(),
1625
- /// ];
1626
- /// // this could get expensive:
1627
- /// assert!(data.contains(&"foo".to_owned()));
1628
- /// // this, less so:
1629
- /// assert!(data.iter().contains("foo"));
1630
- ///
1631
- /// // now the not-as-motivating tests involving Copy data:
1632
- ///
1633
- /// let data = vec![4usize, 5, 1, 3, 0, 2];
1634
- /// assert!(data.iter().contains(&4));
1635
- /// assert!(!data.iter().contains(&6));
1636
- /// for x in (0..50) {
1637
- /// assert_eq!(data.contains(&x), data.iter().contains(&x));
1638
- /// }
1639
- ///
1640
- /// let mut it = data.iter();
1641
- /// assert!(!it.contains(&6));
1642
- /// assert_eq!(it.next(), None);
1643
- ///
1644
- /// let mut it = data.iter();
1645
- /// assert!(it.contains(&3));
1646
- /// assert_eq!(it.next(), Some(&0));
1647
- ///
1648
- /// let data : Option<usize> = None;
1649
- /// assert!(!data.into_iter().contains(0));
1621
+ /// #[derive(PartialEq, Debug)]
1622
+ /// enum Enum { A, B, C, D, E, }
1623
+ ///
1624
+ /// let mut iter = vec![Enum::A, Enum::B, Enum::C, Enum::D].into_iter();
1625
+ ///
1626
+ /// // search `iter` for `B`
1627
+ /// assert_eq!(iter.contains(Enum::B), true);
1628
+ /// // `B` was found, so the iterator now rests at the item after `B` (i.e, `C`).
1629
+ /// assert_eq!(iter.next(), Some(Enum::C));
1630
+ ///
1631
+ /// // search `iter` for `E`
1632
+ /// assert_eq!(iter.contains(Enum::E), false);
1633
+ /// // `E` wasn't found, so `iter` is now exhausted
1634
+ /// assert_eq!(iter.next(), None);
1650
1635
/// ```
1651
1636
fn contains < Q > ( & mut self , query : Q ) -> bool
1652
1637
where
0 commit comments