Skip to content

Commit 8b750a7

Browse files
committed
The example values are now easyer to differenciate
1 parent b937be8 commit 8b750a7

File tree

1 file changed

+8
-8
lines changed
  • src/libstd/collections/hash

1 file changed

+8
-8
lines changed

src/libstd/collections/hash/map.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2026,12 +2026,12 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
20262026
/// use std::collections::HashMap;
20272027
///
20282028
/// let mut map: HashMap<&str, u32> = HashMap::new();
2029-
/// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12);
20302029
///
2031-
/// assert_eq!(map["poneyland"], 12);
2030+
/// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 3);
2031+
/// assert_eq!(map["poneyland"], 3);
20322032
///
2033-
/// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 10).1 += 10;
2034-
/// assert_eq!(map["poneyland"], 22);
2033+
/// *map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 10).1 *= 2;
2034+
/// assert_eq!(map["poneyland"], 6);
20352035
/// ```
20362036
#[unstable(feature = "hash_raw_entry", issue = "54043")]
20372037
pub fn or_insert(self, default_key: K, default_val: V) -> (&'a mut K, &'a mut V)
@@ -2648,12 +2648,12 @@ impl<'a, K, V> Entry<'a, K, V> {
26482648
/// use std::collections::HashMap;
26492649
///
26502650
/// let mut map: HashMap<&str, u32> = HashMap::new();
2651-
/// map.entry("poneyland").or_insert(12);
26522651
///
2653-
/// assert_eq!(map["poneyland"], 12);
2652+
/// map.entry("poneyland").or_insert(3);
2653+
/// assert_eq!(map["poneyland"], 3);
26542654
///
2655-
/// *map.entry("poneyland").or_insert(10) += 10;
2656-
/// assert_eq!(map["poneyland"], 22);
2655+
/// *map.entry("poneyland").or_insert(10) *= 2;
2656+
/// assert_eq!(map["poneyland"], 6);
26572657
/// ```
26582658
pub fn or_insert(self, default: V) -> &'a mut V {
26592659
match self {

0 commit comments

Comments
 (0)