Skip to content

Commit 971d123

Browse files
committed
Update Range to match upstream (#5)
1 parent c7baaeb commit 971d123

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/range.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<V: Ord> Range<V> {
200200
.segments
201201
.last()
202202
.expect("if there is a first element, there must be a last element");
203-
(bound_as_ref(start), bound_as_ref(&end.1))
203+
(start.as_ref(), end.1.as_ref())
204204
})
205205
}
206206

@@ -303,15 +303,6 @@ fn within_bounds<V: PartialOrd>(v: &V, segment: &Interval<V>) -> Ordering {
303303
Ordering::Greater
304304
}
305305

306-
/// Implementation of [`Bound::as_ref`] which is currently marked as unstable.
307-
fn bound_as_ref<V>(bound: &Bound<V>) -> Bound<&V> {
308-
match bound {
309-
Included(v) => Included(v),
310-
Excluded(v) => Excluded(v),
311-
Unbounded => Unbounded,
312-
}
313-
}
314-
315306
fn valid_segment<T: PartialOrd>(start: &Bound<T>, end: &Bound<T>) -> bool {
316307
match (start, end) {
317308
(Included(s), Included(e)) => s <= e,
@@ -518,7 +509,7 @@ impl<V: Display + Eq> Display for Range<V> {
518509
} else {
519510
for (idx, segment) in self.segments.iter().enumerate() {
520511
if idx > 0 {
521-
write!(f, ", ")?;
512+
write!(f, " | ")?;
522513
}
523514
match segment {
524515
(Unbounded, Unbounded) => write!(f, "*")?,
@@ -529,7 +520,7 @@ impl<V: Display + Eq> Display for Range<V> {
529520
if v == b {
530521
write!(f, "=={v}")?
531522
} else {
532-
write!(f, ">={v},<={b}")?
523+
write!(f, ">={v}, <={b}")?
533524
}
534525
}
535526
(Included(v), Excluded(b)) => write!(f, ">={v}, <{b}")?,

0 commit comments

Comments
 (0)