05de787089
[`unnecessary_to_owned`]: check that the adjusted type matches target Fixes #10033. Before this change, the lint would assume that removing the `.to_string()` in `f(&x.to_string())` would be ok if x is of some type that implements `Deref<Target = str>` and `f` takes a `&str`. This turns out to not actually be ok if the `to_string` call is some method that exists on `x` directly, which happens if it implements `Display`/`ToString` itself. changelog: [`unnecessary_to_owned`]: only lint if the adjusted receiver type actually matches