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> {
495495 Idx : PartialOrd < U > ,
496496 U : ?Sized + PartialOrd < Idx > ,
497497 {
498- ! self . exhausted && <Self as RangeBounds < Idx > >:: contains ( self , item)
498+ <Self as RangeBounds < Idx > >:: contains ( self , item)
499499 }
500500
501501 /// Returns `true` if the range contains no items.
@@ -891,7 +891,13 @@ impl<T> RangeBounds<T> for RangeInclusive<T> {
891891 Included ( & self . start )
892892 }
893893 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+ }
895901 }
896902}
897903
You can’t perform that action at this time.
0 commit comments