Commit 830ecbd
committed
Optimize is_sorted for Range and RangeInclusive
The `Step` trait guarantees that `Range<impl Step>` yields items in
sorted order. We can override the `Iterator::is_sorted` method based on
this guarantee, as we already do for `Iterator::min` and `max`.1 parent 8f8092c commit 830ecbd
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
675 | 680 | | |
676 | 681 | | |
677 | 682 | | |
| |||
1095 | 1100 | | |
1096 | 1101 | | |
1097 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1098 | 1108 | | |
1099 | 1109 | | |
1100 | 1110 | | |
| |||
0 commit comments