-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
mark std::string::String::new() and std::vec::Vec::new() as #[must_use]. #50766
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.