-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 suggestion of explicit_counter_loop
#4691
Conversation
I just noticed that the suggestion is kinda wrong; we suggest replacing just the argument of the |
Okay it looks like the only thing that retains the span of the entire original {
let result = match ::std::iter::IntoIterator::into_iter(<head>) {
mut iter => {
[opt_ident]: loop { // <------------- this expr
let mut __next;
match ::std::iter::Iterator::next(&mut iter) {
::std::option::Option::Some(val) => __next = val,
::std::option::Option::None => break
};
let <pat> = __next;
StmtKind::Expr(<body>);
}
}
};
result
} |
iter
if needed in explicit_counter_loop
explicit_counter_loop
@bors r+ thanks! |
📌 Commit a9cb2b9 has been approved by |
Fix suggestion of `explicit_counter_loop` changelog: In the suggestion of `explicit_counter_loop`, if the `for` loop argument doesn't implement `Iterator`, then we suggest `x.into_iter().enumerate()` (or `x.iter{_mut}()` as appropriate). Also, the span of the suggestion has been corrected. Fixes #4678
☀️ Test successful - checks-travis, status-appveyor |
changelog: In the suggestion of
explicit_counter_loop
, if thefor
loop argument doesn't implementIterator
, then we suggestx.into_iter().enumerate()
(orx.iter{_mut}()
as appropriate). Also, the span of the suggestion has been corrected.Fixes #4678