-
Notifications
You must be signed in to change notification settings - Fork 1.7k
manual_map recommends noncompilable code involving moved values #6797
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
Comments
rust-lang/rust-clippy#6797 error[E0382]: use of partially moved value: `self` --> serde_derive/src/internals/attr.rs:71:24 | 71 | self.value.map(|value| (self.tokens, value)) | ----^^^^^^^---------------------- | | | | | | | use occurs due to use in closure | | value used here after partial move | `self.value` partially moved due to this method call | note: this function takes ownership of the receiver `self`, which moves `self.value` --> /home/david/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:485:38 | 485 | pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> { | ^^^^ = note: partial move occurs because `self.value` has type `std::option::Option<T>`, which does not implement the `Copy` trait
@dtolnay you are frequently reporting new false positives, do you have a set of crates that you run clippy on on a regular basis? I can add them to our |
All these crates basically. https://github.com/dtolnay?tab=repositories&type=source&language=rust |
So in that case, we should not lint? Or is there an alternative suggestion we could make? |
I've added anyhow, async-trait, cxx, ryu, serde_yaml and thiserror to the lintcheck sources so that we can easily check if something causes false positives in these crates. |
Applying the suggestion made by clippy makes the code not compile:
@Jarcho @llogiq
The text was updated successfully, but these errors were encountered: