Uh oh!
There was an error while loading. Please reload this page.
Clarify the difference between get_mut and into_mut for OccupiedEntry - #51312
Conversation
The examples for both hash_map::OccupiedEntry::get_mut and hash_map::OccupiedEntry::into_mut were almost identical. This led to some confusion over the difference, namely why you would ever use get_mut when into_mut gives alonger lifetime. Reddit thread: https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps This commit adds two lines and a comment to the example, to show that the entry object can be re-used after calling get_mut.
rust-highfive
commented
Jun 2, 2018
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
frewsxcv
commented
Jun 2, 2018
This is a continuation of #49743. |
dtolnay
commented
Jun 2, 2018
@bors r+ rollup |
bors
commented
Jun 2, 2018
📌 Commit 5473fb4 has been approved by |
rust-highfive
commented
Jun 2, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
5473fb4 to
4974aabComparefrewsxcv
commented
Jun 2, 2018
Fixed the links in the latest force pushes @bors r=dtolnay |
bors
commented
Jun 2, 2018
📌 Commit 4974aab has been approved by |
rust-highfive
commented
Jun 2, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
4974aab to
dd88f88Comparefrewsxcv
commented
Jun 3, 2018
@bors r=dtolnay |
bors
commented
Jun 3, 2018
📌 Commit dd88f88 has been approved by |
…-mut, r=dtolnay Clarify the difference between get_mut and into_mut for OccupiedEntry The examples for both hash_map::OccupiedEntry::get_mut and hash_map::OccupiedEntry::into_mut were almost identical. This led to some confusion over the difference, namely why you would ever use get_mut when into_mut gives alonger lifetime. Reddit thread: https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps This commit adds two lines and a comment to the example, to show that the entry object can be re-used after calling get_mut. Closesrust-lang#49745
Rollup of 6 pull requests Successful merges: - #51143 (Specify that packed types must derive, not implement, Copy) - #51226 (Make Layout's align a NonZeroUsize) - #51297 (Fix run button style) - #51306 (impl Default for &mut str) - #51312 (Clarify the difference between get_mut and into_mut for OccupiedEntry) - #51313 (use type name in E0599 enum variant suggestion) Failed merges:
Phlosioneer
commented
Jun 3, 2018
Thank you @frewsxcv for finishing this. |
The examples for both hash_map::OccupiedEntry::get_mut and
hash_map::OccupiedEntry::into_mut were almost identical. This led to some
confusion over the difference, namely why you would ever use get_mut when
into_mut gives alonger lifetime. Reddit thread:
https://www.reddit.com/r/rust/comments/8a5swr/why_does_hashmaps
This commit adds two lines and a comment to the example, to show that the
entry object can be re-used after calling get_mut.
Closes#49745