assigning_clones: Suggestion conflicts with borrow checker #12444
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
Summary
Nightly Clippy started suggesting usage of
clone_into
but applying the suggesting conflicts with the borrow checker because an immutable borrow of the target variable exists. Assigning works because the borrow ends after the clone is done and hence before the assignment.Reproducer
I started with the warning:
and after applying the suggestion got:
The full code is available here.
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: