Skip to content

Commit b0e583d

Browse files
committed
Remove contains_item from Range*Ext
`contains` was stabilized in Rust 1.35: rust-lang/rust#59152
1 parent bfcf48c commit b0e583d

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

src/inclusive_map.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ where
5757
.filter(|(range_start_wrapper, _value)| {
5858
// Does the only candidate range contain
5959
// the requested key?
60-
//
61-
// TODO: Use `contains` once https://github.com/rust-lang/rust/issues/32311
62-
// is stabilized.
63-
range_start_wrapper.range.contains_item(key)
60+
range_start_wrapper.range.contains(key)
6461
})
6562
.map(|(range_start_wrapper, value)| (&range_start_wrapper.range, value))
6663
}

src/map.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ where
5656
.filter(|(range_start_wrapper, _value)| {
5757
// Does the only candidate range contain
5858
// the requested key?
59-
//
60-
// TODO: Use `contains` once https://github.com/rust-lang/rust/issues/32311
61-
// is stabilized.
62-
range_start_wrapper.range.contains_item(key)
59+
range_start_wrapper.range.contains(key)
6360
})
6461
.map(|(range_start_wrapper, value)| (&range_start_wrapper.range, value))
6562
}

src/std_ext.rs

-18
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ use std::ops::{Range, RangeInclusive};
44
pub trait RangeExt<T> {
55
fn overlaps(&self, other: &Self) -> bool;
66
fn touches(&self, other: &Self) -> bool;
7-
// TODO: Remove once https://github.com/rust-lang/rust/issues/32311
8-
// is stabilized.
9-
fn contains_item(&self, item: &T) -> bool;
107
}
118

129
impl<T> RangeExt<T> for Range<T>
@@ -26,22 +23,13 @@ where
2623
// or immediately adjacent.
2724
max(&self.start, &other.start) <= min(&self.end, &other.end)
2825
}
29-
30-
// TODO: Remove once https://github.com/rust-lang/rust/issues/32311
31-
// is stabilized.
32-
fn contains_item(&self, item: &T) -> bool {
33-
*item >= self.start && *item < self.end
34-
}
3526
}
3627

3728
pub trait RangeInclusiveExt<T> {
3829
fn overlaps(&self, other: &Self) -> bool;
3930
fn touches(&self, other: &Self) -> bool
4031
where
4132
T: StepLite + Bounded + Clone;
42-
// TODO: Remove once https://github.com/rust-lang/rust/issues/32311
43-
// is stabilized.
44-
fn contains_item(&self, item: &T) -> bool;
4533
}
4634

4735
impl<T> RangeInclusiveExt<T> for RangeInclusive<T>
@@ -76,12 +64,6 @@ where
7664
};
7765
max(self.start(), other.start()) <= min(&longer_self_end, &longer_other_end)
7866
}
79-
80-
// TODO: Remove once https://github.com/rust-lang/rust/issues/32311
81-
// is stabilized.
82-
fn contains_item(&self, item: &T) -> bool {
83-
*item >= *self.start() && *item <= *self.end()
84-
}
8567
}
8668

8769
/// Minimal version of unstable [Step](std::iter::Step) trait

0 commit comments

Comments
 (0)