Skip to content
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

[explicit_counter_loop] suggests .into_iter(), despite that triggering [into_iter_on_ref] in some cases #8382

Merged
merged 3 commits into from
Feb 2, 2022

Conversation

tamaroning
Copy link
Contributor

@tamaroning tamaroning commented Feb 1, 2022

I have modified fn make_iterator_snippet in clippy_lints/src/loops/utils.rs ,so this change has some little influence on another lint [manual_flatten] .

fixes #8155


changelog: Fix that [explicit_counter_loop] suggests into_iter() despite that triggering [into_iter_on_ref] in some cases

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @giraffate (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 1, 2022
@tamaroning tamaroning marked this pull request as ready for review February 1, 2022 05:36
Copy link
Contributor

@giraffate giraffate left a comment

Choose a reason for hiding this comment

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

Overall looks good.

let arg_ty = cx.typeck_results().expr_ty_adjusted(arg);
match &arg_ty.kind() {
ty::Ref(_, inner_ty, mutbl) if has_iter_method(cx, inner_ty).is_some() => {
let meth_name = match mutbl {
Copy link
Contributor

Choose a reason for hiding this comment

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

nits

Suggested change
let meth_name = match mutbl {
let method_name = match mutbl {

@tamaroning
Copy link
Contributor Author

@giraffate Thank you for your code review. I have modified code.

@giraffate
Copy link
Contributor

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Feb 2, 2022

📌 Commit f5fd9de has been approved by giraffate

@bors
Copy link
Collaborator

bors commented Feb 2, 2022

⌛ Testing commit f5fd9de with merge bef92b8...

@bors
Copy link
Collaborator

bors commented Feb 2, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing bef92b8 to master...

@bors bors merged commit bef92b8 into rust-lang:master Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explicit_counter_loop suggests .into_iter(), despite that triggering into_iter_on_ref in some cases
4 participants