-
Notifications
You must be signed in to change notification settings - Fork 13k
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 Option::insert
as must_use
#87196
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This on the other hand is merely a style thing where a method that expresses the intent better is available. But it isn't without precedent, e.g. But if this is added, then should |
Seems like a highly subjective style preference to me. |
@the8472 Yes, both of those should be annotated as well. |
@bors r+ |
📌 Commit 774a79e has been approved by |
☀️ Test successful - checks-actions |
Some people seems misled by the function name and use it in case where a simple assignment just works.
If the return value is not used,
option = Some(value);
should be preferred instead ofoption.insert(value);