Skip to content

Commit 9cde2a4

Browse files
committed
Tweak the ComparableRangeBounds example and impl
1 parent 5e9686f commit 9cde2a4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
//! assert_eq!(q2.compare(&key), Ordering::Less);
5858
//! assert_eq!(q3.compare(&key), Ordering::Greater);
5959
//!
60-
//! // You cannot do this with the `RangeBounds::contains` method.
61-
//! // assert!((q1..q3).contains(key));
62-
//! // But you can do this with the `ComparableRangeBounds::compare_contains` method.
60+
//! // You cannot use `Comparable` with the `RangeBounds::contains` method:
61+
//! // assert!((q1..q3).contains(&key));
62+
//!
63+
//! // But you can use the `ComparableRangeBounds::compare_contains` method:
6364
//! assert!((q1..q3).compare_contains(&key));
6465
//! }
6566
//! ```
@@ -143,9 +144,9 @@ pub trait ComparableRangeBounds<Q: ?Sized>: RangeBounds<Q> {
143144
}
144145
}
145146

146-
impl<R, T> ComparableRangeBounds<T> for R
147+
impl<R, Q> ComparableRangeBounds<Q> for R
147148
where
148-
R: ?Sized + RangeBounds<T>,
149-
T: ?Sized,
149+
R: ?Sized + RangeBounds<Q>,
150+
Q: ?Sized,
150151
{
151152
}

0 commit comments

Comments
 (0)