diff options
| author | Meltinglava <meltinglavaoutland@gmail.com> | 2018-11-08 15:33:10 +0100 |
|---|---|---|
| committer | Meltinglava <meltinglavaoutland@gmail.com> | 2018-11-08 15:43:18 +0100 |
| commit | b937be87cb89f08235a57e07e9c73b4489dc50a1 (patch) | |
| tree | 98241e56bd443e2c8433e04e96cca4651ad68c67 /src/libstd/collections | |
| parent | 653da4fd006c97625247acd7e076d0782cdc149b (diff) | |
| download | rust-b937be87cb89f08235a57e07e9c73b4489dc50a1.tar.gz rust-b937be87cb89f08235a57e07e9c73b4489dc50a1.zip | |
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.
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 8de415e8aed..f84e03ae765 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2030,7 +2030,7 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> { /// /// assert_eq!(map["poneyland"], 12); /// - /// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12).1 += 10; + /// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 10).1 += 10; /// assert_eq!(map["poneyland"], 22); /// ``` #[unstable(feature = "hash_raw_entry", issue = "54043")] @@ -2652,7 +2652,7 @@ impl<'a, K, V> Entry<'a, K, V> { /// /// assert_eq!(map["poneyland"], 12); /// - /// *map.entry("poneyland").or_insert(12) += 10; + /// *map.entry("poneyland").or_insert(10) += 10; /// assert_eq!(map["poneyland"], 22); /// ``` pub fn or_insert(self, default: V) -> &'a mut V { |
