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

Removing redundant clone() #6998

Closed
xdb64 opened this issue Mar 29, 2021 · 0 comments · Fixed by #7011
Closed

Removing redundant clone() #6998

xdb64 opened this issue Mar 29, 2021 · 0 comments · Fixed by #7011
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

Comments

@xdb64
Copy link

xdb64 commented Mar 29, 2021

Lint name: clippy::redundant-clone

I tried this code:

    state
        .query
        .clone()
        .chars()
        .for_each(|_| user_interface.move_cursor(&mut state, Direction::Forward));

Removing clone() from this causes:

error[E0502]: cannot borrow `state` as mutable because it is also borrowed as immutable

Meta

$ cargo clippy -V
clippy 0.1.51 (2fd73fa 2021-03-23)
$ rustc -Vv
rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

For context, see this

@xdb64 xdb64 added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 29, 2021
@giraffate giraffate added the I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied label Mar 29, 2021
@bors bors closed this as completed in 92c4fc3 Apr 1, 2021
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 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants