unnecessary_to_owned
causes borrowing error after removing to_vec
#12098
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Uh oh!
There was an error while loading. Please reload this page.
Summary
Clippy suggests to remove
to_vec
which results in compile error: "cannot assign totest.mut_this
because it is borrowed". In this caseto_vec
is required as it copiesself
so that it's no longer borrowed.Lint Name
clippy::unnecessary_to_owned
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warning
Version
Additional Labels
@rustbot label I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: