@@ -1146,7 +1146,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
1146
1146
#[ unstable( feature = "std_misc" ,
1147
1147
reason = "will soon be replaced by or_insert" ) ]
1148
1148
#[ 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 `" ) ]
1150
1150
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
1151
1151
pub fn get ( self ) -> Result < & ' a mut V , VacantEntry < ' a , K , V > > {
1152
1152
match self {
@@ -1159,7 +1159,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
1159
1159
reason = "matches entry v3 specification, waiting for dust to settle" ) ]
1160
1160
/// Ensures a value is in the entry by inserting the default if empty, and returns
1161
1161
/// 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 {
1163
1163
match self {
1164
1164
Occupied ( entry) => entry. into_mut ( ) ,
1165
1165
Vacant ( entry) => entry. insert ( default) ,
@@ -1170,7 +1170,7 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
1170
1170
reason = "matches entry v3 specification, waiting for dust to settle" ) ]
1171
1171
/// Ensures a value is in the entry by inserting the result of the default function if empty,
1172
1172
/// 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 {
1174
1174
match self {
1175
1175
Occupied ( entry) => entry. into_mut ( ) ,
1176
1176
Vacant ( entry) => entry. insert ( default ( ) ) ,
@@ -1592,7 +1592,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
1592
1592
///
1593
1593
/// // count the number of occurrences of letters in the vec
1594
1594
/// 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;
1596
1596
/// }
1597
1597
///
1598
1598
/// assert_eq!(count["a"], 3);
0 commit comments