Skip to content

Commit d4a2937

Browse files
mmiratejswrenn
andauthored
Update src/lib.rs
Co-authored-by: Jack Wrenn <[email protected]>
1 parent 3c4d784 commit d4a2937

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,8 +1616,6 @@ pub trait Itertools : Iterator {
16161616
/// iterator will be exhausted.
16171617
///
16181618
/// ```
1619-
/// use itertools::Itertools;
1620-
///
16211619
/// #[derive(PartialEq, Debug)]
16221620
/// enum Enum { A, B, C, D, E, }
16231621
///
@@ -1633,12 +1631,13 @@ pub trait Itertools : Iterator {
16331631
/// // `E` wasn't found, so `iter` is now exhausted
16341632
/// assert_eq!(iter.next(), None);
16351633
/// ```
1636-
fn contains<Q>(&mut self, query: Q) -> bool
1634+
fn contains<Q>(&mut self, query: &Q) -> bool
16371635
where
16381636
Self: Sized,
1639-
Self::Item: PartialEq<Q>,
1637+
Self::Item: Borrow<Q>,
1638+
Q: PartialEq,
16401639
{
1641-
self.any(|x| x == query)
1640+
self.any(|x| x.borrow() == query)
16421641
}
16431642

16441643
/// Check whether all elements compare equal.

0 commit comments

Comments
 (0)