Commit 3f40a9d
committed
Optimize
The check for `self.end() == usize::MAX` can be combined with the `self.end() +
1 > slice.len()` check into `self.en() >= slice.len()`, since `self.end() <
slice.len()` implies both `self.end() <= slice.len()` and `self.end() <
usize::MAX`.
The tradeoff is slightly worse error reporting: previously there would be a
special panic message in the `range.end() == usize::MAX` case.SliceIndex impl for RangeInclusive
1 parent 3d8c1c1 commit 3f40a9d
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
656 | 655 | | |
657 | 656 | | |
658 | 657 | | |
| |||
662 | 661 | | |
663 | 662 | | |
664 | 663 | | |
665 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
666 | 667 | | |
667 | 668 | | |
668 | 669 | | |
669 | 670 | | |
670 | | - | |
| 671 | + | |
671 | 672 | | |
672 | 673 | | |
673 | 674 | | |
| |||
0 commit comments