Skip to content

Conversation

emberian
Copy link
Contributor

No description provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let opt_bound = do self.state.to_uint().and_then |a| {
     do self.stop.to_uint().map(|b| b - a);
};
opt_bound.map_default((uint::max_value, None), |bound| (bound, Some(bound)))

maybe?

Also, what happens if b - a wraps? (Is it possible with a sane type A?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, also, what about range(-10i, -1i).size_hint()? Won't this give uint::max_value as the lower bound, incorrectly?

@bors bors closed this Nov 11, 2013
@bors bors merged commit fc01f20 into rust-lang:master Nov 11, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 30, 2023
…shearth

Extend `explicit_iter_loop` and `explicit_into_iter_loop`

fixes rust-lang#1518

Some included cleanups
* Split `for_loop` test into different files for each lint (partially).
* Move handling of some `into_iter` cases from `explicit_into_iter`.

---

changelog: Enhancement: [`explicit_iter_loop`]: Now also handles types that implement `IntoIterator`.
[rust-lang#10416](rust-lang/rust-clippy#10416)

changelog: Sugg: [`explicit_into_iter_loop`]: The suggestion now works on mutable references.
[rust-lang#10416](rust-lang/rust-clippy#10416)
<!-- changelog_checked -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants