@@ -2026,12 +2026,12 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
2026
2026
/// use std::collections::HashMap;
2027
2027
///
2028
2028
/// let mut map: HashMap<&str, u32> = HashMap::new();
2029
- /// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 12);
2030
2029
///
2031
- /// assert_eq!(map["poneyland"], 12);
2030
+ /// map.raw_entry_mut().from_key("poneyland").or_insert("poneyland", 3);
2031
+ /// assert_eq!(map["poneyland"], 3);
2032
2032
///
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 );
2035
2035
/// ```
2036
2036
#[ unstable( feature = "hash_raw_entry" , issue = "54043" ) ]
2037
2037
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> {
2648
2648
/// use std::collections::HashMap;
2649
2649
///
2650
2650
/// let mut map: HashMap<&str, u32> = HashMap::new();
2651
- /// map.entry("poneyland").or_insert(12);
2652
2651
///
2653
- /// assert_eq!(map["poneyland"], 12);
2652
+ /// map.entry("poneyland").or_insert(3);
2653
+ /// assert_eq!(map["poneyland"], 3);
2654
2654
///
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 );
2657
2657
/// ```
2658
2658
pub fn or_insert ( self , default : V ) -> & ' a mut V {
2659
2659
match self {
0 commit comments