Commit 57f1ce6
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 f5703d5 commit 57f1ce6
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
654 | 653 | | |
655 | 654 | | |
656 | 655 | | |
| |||
660 | 659 | | |
661 | 660 | | |
662 | 661 | | |
663 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
664 | 665 | | |
665 | 666 | | |
666 | 667 | | |
667 | 668 | | |
668 | | - | |
| 669 | + | |
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
| |||
0 commit comments