Skip to content

Commit 800a112

Browse files
committed
Remove use of 1.75 unstable function
Signed-off-by: Michael X. Grey <mxgrey@intrinsic.ai>
1 parent 096ccf4 commit 800a112

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/buffer/any_buffer.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,20 @@ pub(crate) struct AnyRange {
514514
impl AnyRange {
515515
pub(crate) fn new<T: std::ops::RangeBounds<usize>>(range: T) -> Self {
516516
AnyRange {
517-
start_bound: range.start_bound().map(|x| *x),
518-
end_bound: range.end_bound().map(|x| *x),
517+
start_bound: deref_bound(range.start_bound()),
518+
end_bound: deref_bound(range.end_bound()),
519519
}
520520
}
521521
}
522522

523+
fn deref_bound(bound: std::ops::Bound<&usize>) -> std::ops::Bound<usize> {
524+
match bound {
525+
std::ops::Bound::Included(v) => std::ops::Bound::Included(*v),
526+
std::ops::Bound::Excluded(v) => std::ops::Bound::Excluded(*v),
527+
std::ops::Bound::Unbounded => std::ops::Bound::Unbounded,
528+
}
529+
}
530+
523531
impl std::ops::RangeBounds<usize> for AnyRange {
524532
fn start_bound(&self) -> std::ops::Bound<&usize> {
525533
self.start_bound.as_ref()

0 commit comments

Comments
 (0)