-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Consider deref'ed argument as non-temporary #15172
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
Conversation
@rustbot label +I-suggestion-causes-bug +beta-nominated Nominating for beta (1.89) since the lint and the issue with |
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice. Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences.
8d68ea5
to
ad7de94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Changes in this PR restrict further when the lint is emitted and most changes are applied to the suggestion. Accepted for backport. |
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice. Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences. Fixes rust-lang/rust-clippy#15166 changelog: [`swap_with_temporary`]: fix false positive leading to different semantics being suggested, and use the right number of dereferences in suggestion r? y21 <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [beta-nomination](rust-lang/rust-clippy#15172 (comment)) by [samueltardieu](https://github.com/samueltardieu) *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/note.html) for details* <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice. Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences. Fixes rust-lang/rust-clippy#15166 changelog: [`swap_with_temporary`]: fix false positive leading to different semantics being suggested, and use the right number of dereferences in suggestion r? y21 <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [beta-nomination](rust-lang/rust-clippy#15172 (comment)) by [samueltardieu](https://github.com/samueltardieu) *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/note.html) for details* <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice. Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences. Fixes rust-lang/rust-clippy#15166 changelog: [`swap_with_temporary`]: fix false positive leading to different semantics being suggested, and use the right number of dereferences in suggestion r? y21 <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [beta-nomination](rust-lang/rust-clippy#15172 (comment)) by [samueltardieu](https://github.com/samueltardieu) *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/note.html) for details* <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
If there are more than one dereference (there is one corresponding matched with a borrow in any case), consider that the argument might point to a place expression, which is the safest choice.
Also, use an appropriate number of dereferences in suggestions involving arguments using themselves multiple dereferences.
Fixes #15166
changelog: [
swap_with_temporary
]: fix false positive leading to different semantics being suggested, and use the right number of dereferences in suggestionr? y21
Summary Notes
Managed by
@rustbot
—see help for details