Skip to content
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

Clarifying documentation for collections::hash_map::Entry::or_insert #55784

Merged
merged 2 commits into from
Nov 22, 2018

Conversation

meltinglava
Copy link
Contributor

Previous version does not show that or_insert does not insert the passed value, as the passed value was the same value as what was already in the map.

Previous version does not show that or_insert does not insert the
passed value, as the passed value was the same value as what was
already in the map.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @KodrAus (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 8, 2018
@KodrAus
Copy link
Contributor

KodrAus commented Nov 12, 2018

Thanks @meltinglava! Hm, maybe we could make it even clearer by picking a completely different number than either 10 or 12 as the discarded value for or_insert? Maybe 0 or 500 or something?

@meltinglava
Copy link
Contributor Author

I agree. I slept on it and have found that the goal is that the numbers in them self should be not to different (distracting) while yet be different enought. Also I think that using 0 in this example is not ideal as in alot of the other languages it will be a falsy value (yes rust does not have this but better leave the possibility of confusing out).

@meltinglava
Copy link
Contributor Author

Now this version is the one that i found the easyiest.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 19, 2018

Looks good to me! Thanks @meltinglava

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 19, 2018

📌 Commit 8b750a7 has been approved by KodrAus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2018
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 22, 2018
Clarifying documentation for collections::hash_map::Entry::or_insert

Previous version does not show that or_insert does not insert the passed value, as the passed value was the same value as what was already in the map.
bors added a commit that referenced this pull request Nov 22, 2018
Rollup of 11 pull requests

Successful merges:

 - #55367 (lint if a private item has doctests)
 - #55485 (Return &T / &mut T in ManuallyDrop Deref(Mut) impl)
 - #55784 (Clarifying documentation for collections::hash_map::Entry::or_insert)
 - #55961 (Fix VecDeque pretty-printer)
 - #55980 (Suggest on closure args count mismatching with pipe span)
 - #56002 (fix #55972: Erroneous self arguments on bare functions emit subpar compilation error)
 - #56063 (Update any.rs documentation using keyword dyn)
 - #56067 (Add SGX target to rustc)
 - #56078 (Fix error message for `-C panic=xxx`.)
 - #56106 (Remove some incorrect doc comments)
 - #56126 (core/benches/num: Add `from_str/from_str_radix()` benchmarks)

Failed merges:

r? @ghost
@bors bors merged commit 8b750a7 into rust-lang:master Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants