mark std::string::String::new() and std::vec::Vec::new() as #[must_use].#50766
mark std::string::String::new() and std::vec::Vec::new() as #[must_use].#50766matthiaskrgr wants to merge 1 commit into
Conversation
|
r? @TimNN (rust_highfive has picked a reviewer for you, use r? to override) |
|
Could you say a bit about the motivation? With many other methods where must_use is being proposed, I can see an argument about not using the result hiding a specific, subtle bug (e.g., calling |
|
I suppose that the motivation is that if the return value is dead code then the constructing call is always dead code. |
|
In #48926 (comment), @est31 proposed a new lint that would obviate the need for changes like this (since both methods are const) which I think is a better approach than manually annotating all these. |
|
I think we'll need some more consensus on general guidelines which |
|
Thank you for your PR! It doesn't look like there will be a decision about how to handle |
No description provided.