Skip to content

Commit

Permalink
Add symmetric requirement of PartialOrd.
Browse files Browse the repository at this point in the history
  • Loading branch information
smmalis37 committed Apr 11, 2018
1 parent 249dc9e commit 51f24ec
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
pub fn contains<U>(&self, item: &U) -> bool
where
Idx: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
pub fn contains<U>(&self, item: &U) -> bool
where
Idx: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
pub fn contains<U>(&self, item: &U) -> bool
where
Idx: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
Expand Down Expand Up @@ -369,7 +369,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
pub fn contains<U>(&self, item: &U) -> bool
where
Idx: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
Expand Down Expand Up @@ -487,7 +487,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
pub fn contains<U>(&self, item: &U) -> bool
where
Idx: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<Idx>,
{
<Self as RangeBounds<Idx>>::contains(self, item)
}
Expand Down Expand Up @@ -612,7 +612,7 @@ pub trait RangeBounds<T: ?Sized> {
fn contains<U>(&self, item: &U) -> bool
where
T: PartialOrd<U>,
U: ?Sized,
U: ?Sized + PartialOrd<T>,
{
(match self.start() {
Included(ref start) => *start <= item,
Expand All @@ -621,8 +621,8 @@ pub trait RangeBounds<T: ?Sized> {
})
&&
(match self.end() {
Included(ref end) => *end >= item,
Excluded(ref end) => *end > item,
Included(ref end) => item <= *end,
Excluded(ref end) => item < *end,
Unbounded => true,
})
}
Expand Down

0 comments on commit 51f24ec

Please sign in to comment.