Enhance drop forget ref hint#156395
Conversation
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
As I said in #155895 (comment), I don't think we should do that, being a bit vague was on purpose. Further-more the suggestion is not right when there is an explicit borrow, like in https://github.com/rust-lang/rust/pull/156395/changes#diff-caa7b472da1b6aa2b42ea519f4bdd7eef6c5c031a32a342110116db9b83dde97R14. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Why is I don’t quite understand from what angle this way of writing is considered incorrect. From my perspective, this syntax either brings about side effects or is used to disable the "unused variable" lint, and its effect seems roughly equivalent to However, developers may mistakenly assume that Therefore in my opinion, if (Translated by LLM) |
Same as If we are at a point where we are suggesting something to the user, it would be better to suggest code that actually does something. |
|
Ok, I got it Maybe we can give the user links to primitive reference and std::mem::drop as a note, because users only try to drop references due to a lack of relevant knowledge. keep |
|
Sure, if you think linking to I'm not sure we add a link to the reference type. If the goal was to make it clear that a reference is |
Replace
let _ = ...withlet _ = drop_argChanged some hint messages
Fixes: #155895