mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
94ce4465e5
Fix #9771 (`unnecessary_to_owned` false positive) Fixes #9771 In that issue's example(s), the lint tried to add a `&` to a value, which implicitly changed the type of a field to a reference. The fix is to add the reference to `receiver_ty` (the type of the receiver of the `to_owned`-like method), before passing `receiver_ty` to `can_change_type`. `can_change_type` properly rejects the modified `receiver_ty`. cc: `@mikerite` just because I think he was the author of `can_change_type`. changelog: fix `unnecessary_to_owned` false positive which implicitly tried to change the type of a field to a reference