@@ -1221,6 +1221,8 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
1221
1221
}
1222
1222
1223
1223
impl < K : Eq + Hash < S > , V : Clone , S , H : Hasher < S > > HashMap < K , V , H > {
1224
+ /// Deprecated: Use `map.get(k).cloned()`.
1225
+ ///
1224
1226
/// Return a copy of the value corresponding to the key.
1225
1227
///
1226
1228
/// # Example
@@ -1232,10 +1234,13 @@ impl<K: Eq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
1232
1234
/// map.insert(1u, "foo".to_string());
1233
1235
/// let s: String = map.find_copy(&1).unwrap();
1234
1236
/// ```
1237
+ #[ deprecated = "Use `map.get(k).cloned()`" ]
1235
1238
pub fn find_copy ( & self , k : & K ) -> Option < V > {
1236
- self . get ( k) . map ( |v| ( * v ) . clone ( ) )
1239
+ self . get ( k) . cloned ( )
1237
1240
}
1238
1241
1242
+ /// Deprecated: Use `map[k].clone()`.
1243
+ ///
1239
1244
/// Return a copy of the value corresponding to the key.
1240
1245
///
1241
1246
/// # Failure
@@ -1251,6 +1256,7 @@ impl<K: Eq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
1251
1256
/// map.insert(1u, "foo".to_string());
1252
1257
/// let s: String = map.get_copy(&1);
1253
1258
/// ```
1259
+ #[ deprecated = "Use `map[k].clone()`" ]
1254
1260
pub fn get_copy ( & self , k : & K ) -> V {
1255
1261
self [ * k] . clone ( )
1256
1262
}
0 commit comments