]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #51312 - frewsxcv:clarify-hash-map-entry-get-mut, r=dtolnay
authorMark Simulacrum <mark.simulacrum@gmail.com>
Sun, 3 Jun 2018 01:55:09 +0000 (19:55 -0600)
committerGitHub <noreply@github.com>
Sun, 3 Jun 2018 01:55:09 +0000 (19:55 -0600)
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.

Closes https://github.com/rust-lang/rust/issues/49745


Trivial merge