-
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
Tweak insert docs #97611
Tweak insert docs #97611
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
@bors r+ rollup |
📌 Commit b02146a has been approved by |
Rollup of 9 pull requests Successful merges: - rust-lang#94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap) - rust-lang#97216 (Ensure we never consider the null pointer dereferencable) - rust-lang#97399 (simplify code of finding arg index in `opt_const_param_of`) - rust-lang#97470 (rustdoc: add more test coverage) - rust-lang#97498 (Corrected EBNF grammar for from_str) - rust-lang#97562 (Fix comment in `poly_project_and_unify_type`) - rust-lang#97580 (Add regression test for rust-lang#71546) - rust-lang#97611 (Tweak insert docs) - rust-lang#97616 (Remove an unnecessary `Option`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
For
{Hash, BTree}Map::insert
, I always have to take a few extra seconds to think about the slight weirdness about the fact that if we "did not" insert (which "sounds" false), we return true, and if we "did" insert, (which "sounds" true), we return false.This tweaks the doc comments for the
insert
methods of those types (as well as what looks like a rustc internal data structure that I found just by searching the codebase for "If the set did") to first use the "Returns whether something" pattern used in e.g.remove
, where we say thatremove
"returns whether the value was present".