@@ -1146,7 +1146,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
11461146 #[ unstable( feature = "std_misc" ,
11471147 reason = "will soon be replaced by or_insert" ) ]
11481148 #[ deprecated( since = "1.0" ,
1149- reason = "replaced with more ergonomic `default ` and `default_with `" ) ]
1149+ reason = "replaced with more ergonomic `or_insert ` and `or_insert_with `" ) ]
11501150 /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
11511151 pub fn get ( self ) -> Result < & ' a mut V , VacantEntry < ' a , K , V > > {
11521152 match self {
@@ -1159,7 +1159,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
11591159 reason = "matches entry v3 specification, waiting for dust to settle" ) ]
11601160 /// Ensures a value is in the entry by inserting the default if empty, and returns
11611161 /// a mutable reference to the value in the entry.
1162- pub fn default ( self , default : V ) -> & ' a mut V {
1162+ pub fn or_insert ( self , default : V ) -> & ' a mut V {
11631163 match self {
11641164 Occupied ( entry) => entry. into_mut ( ) ,
11651165 Vacant ( entry) => entry. insert ( default) ,
@@ -1170,7 +1170,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
11701170 reason = "matches entry v3 specification, waiting for dust to settle" ) ]
11711171 /// Ensures a value is in the entry by inserting the result of the default function if empty,
11721172 /// and returns a mutable reference to the value in the entry.
1173- pub fn default_with < F : FnOnce ( ) -> V > ( self , default : F ) -> & ' a mut V {
1173+ pub fn or_insert_with < F : FnOnce ( ) -> V > ( self , default : F ) -> & ' a mut V {
11741174 match self {
11751175 Occupied ( entry) => entry. into_mut ( ) ,
11761176 Vacant ( entry) => entry. insert ( default ( ) ) ,
@@ -1592,7 +1592,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
15921592 ///
15931593 /// // count the number of occurrences of letters in the vec
15941594 /// for x in vec!["a","b","a","c","a","b"] {
1595- /// *count.entry(x).default (0) += 1;
1595+ /// *count.entry(x).or_insert (0) += 1;
15961596 /// }
15971597 ///
15981598 /// assert_eq!(count["a"], 3);
0 commit comments