False positive for clone_on_copy #4384
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
I've encountered a false positive, when calling
.clone()
on a field of a struct. Followed by calling a method (&self
) that takes a closure, which borrows the original struct.I encountered it using the
glfw
crate, and boils down to the following:Clippy suggests removing
.clone()
sinceGlfw
implementsCopy
.However, that doesn't work, since it would reborrow
window
.Here's two minimal, reproducible examples.
Example 1
Example 2
I'm aware that changing
&self
toself
and removing.clone()
works. However, that would require me to modifyglfw
.Version: clippy 0.0.212 (082cfa7 2019-06-07)
The text was updated successfully, but these errors were encountered: