mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
4a56563154
needless_borrows_for_generic_args: Handle when field operand impl Drop Before this fix, the lint had a false positive, namely when a reference was taken to a field when the field operand implements a custom Drop. The compiler will refuse to partially move a type that implements Drop, because that would put the type in a weird state. ## False Positive Example (Fixed) ```rs struct CustomDrop(String); impl Drop for CustomDrop { fn drop(&mut self) {} } fn check_str<P: AsRef<str>>(_to: P) {} fn test() { let owner = CustomDrop(String::default()); check_str(&owner.0); // Don't lint. `owner` can't be partially moved because it impl Drop } ``` changelog: [`needless_borrows_for_generic_args`]: Handle when field operand impl Drop |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |