File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -495,7 +495,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
495
495
Idx : PartialOrd < U > ,
496
496
U : ?Sized + PartialOrd < Idx > ,
497
497
{
498
- ! self . exhausted && <Self as RangeBounds < Idx > >:: contains ( self , item)
498
+ <Self as RangeBounds < Idx > >:: contains ( self , item)
499
499
}
500
500
501
501
/// Returns `true` if the range contains no items.
@@ -891,7 +891,13 @@ impl<T> RangeBounds<T> for RangeInclusive<T> {
891
891
Included ( & self . start )
892
892
}
893
893
fn end_bound ( & self ) -> Bound < & T > {
894
- Included ( & self . end )
894
+ if self . exhausted {
895
+ // When the iterator is exhausted, we usually have start == end,
896
+ // but we want the range to appear empty, containing nothing.
897
+ Excluded ( & self . end )
898
+ } else {
899
+ Included ( & self . end )
900
+ }
895
901
}
896
902
}
897
903
You can’t perform that action at this time.
0 commit comments