File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -514,12 +514,20 @@ pub(crate) struct AnyRange {
514
514
impl AnyRange {
515
515
pub ( crate ) fn new < T : std:: ops:: RangeBounds < usize > > ( range : T ) -> Self {
516
516
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 ( ) ) ,
519
519
}
520
520
}
521
521
}
522
522
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
+
523
531
impl std:: ops:: RangeBounds < usize > for AnyRange {
524
532
fn start_bound ( & self ) -> std:: ops:: Bound < & usize > {
525
533
self . start_bound . as_ref ( )
You can’t perform that action at this time.
0 commit comments