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

Fix map_clone bad suggestion #3662

Merged
merged 4 commits into from Jan 15, 2019
Merged

Fix map_clone bad suggestion #3662

merged 4 commits into from Jan 15, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jan 15, 2019

cloned requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting .cloned only if it is a reference. When the closure
argument is not a reference, it suggests removing the map call instead.

A minor problem with this change is that the new check sometimes overlaps
with the clone_on_copy lint.

Fixes #498

Michael Wright added 4 commits January 15, 2019 08:09
`cloned` requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting `.cloned` only if it is a reference. When the closure
argument is not a reference, it suggests removing the `map` call instead.

A minor problem with this change is that the new check sometimes overlaps
with the `clone_on_copy` lint.

Fixes #498
@oli-obk
Copy link
Contributor

oli-obk commented Jan 15, 2019

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 15, 2019

📌 Commit 89de4c9 has been approved by oli-obk

@bors
Copy link
Collaborator

bors commented Jan 15, 2019

⌛ Testing commit 89de4c9 with merge 1b89724...

bors added a commit that referenced this pull request Jan 15, 2019
Fix `map_clone` bad suggestion

`cloned` requires that the elements of the iterator must be references. This
change determines if that is the case by examining the type of the closure
argument and suggesting `.cloned` only if it is a reference. When the closure
argument is not a reference, it suggests removing the `map` call instead.

A minor problem with this change is that the new check sometimes overlaps
with the `clone_on_copy` lint.

Fixes #498
@bors
Copy link
Collaborator

bors commented Jan 15, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 1b89724 to master...

@bors bors merged commit 89de4c9 into rust-lang:master Jan 15, 2019
@ghost ghost deleted the fix-498 branch May 11, 2019 08:07
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.

2 participants