-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix size_hint on Skip #8375
Fix size_hint on Skip #8375
Conversation
If the upper bound of the wrapped iterator has saturated at uint::max_value, keep it there. It may actually represent an upper bound that is higher.
I thought infinite iterators should use |
@blake2-ppc: you're right - if they can't represent the upper bound as |
@thestinger I thought we had decided that I've been giving some thought as to whether we should actually use an enum for this case, to distinguish |
The lower and upper bounds are limits, so if it can't be represented in a |
Fair enough. I don't remember anymore what led me to believe we had decided that |
@kballard: the lower bound should be pegged to |
@thestinger I feel like the idea was that when adapting an iterator in a fashion that would raise the upper bound (e.g. In any case, since you don't think this is the approach we should take, then we may have to fix the iterators that increase the upper bound to detect overflow and flip to |
It's not necessarily that I don't think it's the approach we should take, but right now the second element is defined as the upper bound and if the iterator yields more elements it's not a bound. |
… r=giraffate Take over: New lint bytes count to len take over rust-lang#8375 close rust-lang#8083 This PR adds new lint about considering replacing `.bytes().count()` with `.len()`. Thank you in advance. --- r! `@Manishearth` changelog: adds new lint [`bytes_count_to_len`] to consider replacing `.bytes().count()` with `.len()`
If the upper bound of the wrapped iterator has saturated at
uint::max_value, keep it there. It may actually represent an upper bound
that is higher.
r? @thestinger