rust-clippy/clippy_lints
bors 4a56563154 Auto merge of #11900 - Enselic:needless-borrow-drop, r=Manishearth
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
2023-12-05 19:10:09 +00:00
..
src Auto merge of #11900 - Enselic:needless-borrow-drop, r=Manishearth 2023-12-05 19:10:09 +00:00
Cargo.toml Update regex-syntax to support new word boundry assertions 2023-12-02 19:44:36 +00:00
README.md

This crate contains Clippy lints. For the main crate, check GitHub.