-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Redesign the std::iter::Step trait, tweak related iterator impls for ranges #43127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d103522
Check integer overflow/underflow in Range* iterators
SimonSapin 3e8a762
Don’t reset RangeInclusive to 1...0 after last iteration.
SimonSapin 5334226
Rename Step::{add,sub}_usize to Step::forward and Step::backward
SimonSapin 32d963e
Rewrite mixed-width mixed-signedness integer arithmetic in Step impls
SimonSapin 9d4dc29
Add tests for Step trait methods
SimonSapin c0b4440
Implement TrustedLen for ranges of all integer types
SimonSapin b270e7f
Tighter size_hint lower bound for ranges larger than usize
SimonSapin 287ce4c
Remove ExactSizeIterator impls for RangeInclusive<{i16,u16}>
SimonSapin eed9884
Add a comment on the `start > end` check in RangeInclusive::size_hint
SimonSapin 0a62269
Make tidy happy
SimonSapin 0ac7fca
Implement TrustedLen for ranges of all T: Step, make Step an unsafe t…
SimonSapin Jul 9, 2017
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Implement TrustedLen for ranges of all T: Step, make Step an unsafe t…
…rait.
- Loading branch information
commit 0ac7fca8341f132d228d95fa7c6d5e9c07763969
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth a
fn forward_one(&self) -> Option<Self> { self.forward(1) }
(or call itsuccessor
, perhaps, like the comment here does) so the common case is overridable if needed? I suppose it's always addable later if needed.