-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Should map_clone
trigger on copies of double references?
#3958
Labels
C-bug
Category: Clippy is not doing the correct thing
S-needs-discussion
Status: Needs further discussion before merging or work can be started
Comments
Manishearth
added
C-bug
Category: Clippy is not doing the correct thing
S-needs-discussion
Status: Needs further discussion before merging or work can be started
labels
Apr 13, 2019
Note that there's also |
In that case we should definitely suggest that whenever possible. |
This was referenced Apr 15, 2019
Fixed in #3970, but we can't land that until |
bors
added a commit
that referenced
this issue
Apr 16, 2019
Suggest .copied() instead of .cloned() in map_clone where applicable partial fix for #3958 changelog: Improve suggestion in `map_clone` to suggest `.copied()` where applicable
|
Sweet, put next steps here: #4043 |
bors
added a commit
that referenced
this issue
Apr 28, 2019
Suggest .copied() for map_clone on iterators too fixes #3958 changelog: Make `map_clone` suggest the newly-stable `Iterator::copied()` when applicable r? @mikerite @matthiaskrgr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
S-needs-discussion
Status: Needs further discussion before merging or work can be started
playpen
So
map_clone
triggers even for copies, which makes sense, sincecloned()
works on copies. Here it specificially is triggering on copies of a double reference.However, we also have
clone_double_ref
which warns about cloning&&T
since that may not do what one expected.Also
.map(|&x| x)
is much clearer than.cloned()
in such cases, it's not at all obvious that the.cloned()
is there to unwrap a referenceI feel that this is a false positive, but I can see others disagreeing. Thoughts?
h/t @hawkw
The text was updated successfully, but these errors were encountered: