@@ -195,7 +195,7 @@ impl<V: Ord> Range<V> {
195
195
. segments
196
196
. last ( )
197
197
. expect ( "if there is a first element, there must be a last element" ) ;
198
- ( bound_as_ref ( start) , bound_as_ref ( & end. 1 ) )
198
+ ( start. as_ref ( ) , end. 1 . as_ref ( ) )
199
199
} )
200
200
}
201
201
@@ -264,15 +264,6 @@ impl<V: Ord> Range<V> {
264
264
}
265
265
}
266
266
267
- /// Implementation of [`Bound::as_ref`] which is currently marked as unstable.
268
- fn bound_as_ref < V > ( bound : & Bound < V > ) -> Bound < & V > {
269
- match bound {
270
- Included ( v) => Included ( v) ,
271
- Excluded ( v) => Excluded ( v) ,
272
- Unbounded => Unbounded ,
273
- }
274
- }
275
-
276
267
fn valid_segment < T : PartialOrd > ( start : & Bound < T > , end : & Bound < T > ) -> bool {
277
268
match ( start, end) {
278
269
( Included ( s) , Included ( e) ) => s <= e,
@@ -307,7 +298,7 @@ impl<V: Ord + Clone> Range<V> {
307
298
308
299
( Included ( i) , Excluded ( e) ) | ( Excluded ( e) , Included ( i) ) if i <= e => Excluded ( e) ,
309
300
( Included ( i) , Excluded ( e) ) | ( Excluded ( e) , Included ( i) ) if e < i => Included ( i) ,
310
- ( s, Unbounded ) | ( Unbounded , s) => bound_as_ref ( s ) ,
301
+ ( s, Unbounded ) | ( Unbounded , s) => s . as_ref ( ) ,
311
302
_ => unreachable ! ( ) ,
312
303
}
313
304
. cloned ( ) ;
@@ -317,7 +308,7 @@ impl<V: Ord + Clone> Range<V> {
317
308
318
309
( Included ( i) , Excluded ( e) ) | ( Excluded ( e) , Included ( i) ) if i >= e => Excluded ( e) ,
319
310
( Included ( i) , Excluded ( e) ) | ( Excluded ( e) , Included ( i) ) if e > i => Included ( i) ,
320
- ( s, Unbounded ) | ( Unbounded , s) => bound_as_ref ( s ) ,
311
+ ( s, Unbounded ) | ( Unbounded , s) => s . as_ref ( ) ,
321
312
_ => unreachable ! ( ) ,
322
313
}
323
314
. cloned ( ) ;
@@ -373,7 +364,7 @@ impl<V: Display + Eq> Display for Range<V> {
373
364
} else {
374
365
for ( idx, segment) in self . segments . iter ( ) . enumerate ( ) {
375
366
if idx > 0 {
376
- write ! ( f, ", " ) ?;
367
+ write ! ( f, " | " ) ?;
377
368
}
378
369
match segment {
379
370
( Unbounded , Unbounded ) => write ! ( f, "*" ) ?,
@@ -384,7 +375,7 @@ impl<V: Display + Eq> Display for Range<V> {
384
375
if v == b {
385
376
write ! ( f, "{v}" ) ?
386
377
} else {
387
- write ! ( f, ">={v},<={b}" ) ?
378
+ write ! ( f, ">={v}, <={b}" ) ?
388
379
}
389
380
}
390
381
( Included ( v) , Excluded ( b) ) => write ! ( f, ">={v}, <{b}" ) ?,
0 commit comments