@@ -1220,36 +1220,18 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
1220
1220
}
1221
1221
1222
1222
impl < K : Eq + Hash < S > , V : Clone , S , H : Hasher < S > > HashMap < K , V , H > {
1223
- /// Return a copy of the value corresponding to the key.
1224
- ///
1225
- /// # Example
1223
+ /// Deprecated: Use `map.get(k).cloned()`.
1226
1224
///
1227
- /// ```
1228
- /// use std::collections::HashMap;
1229
- ///
1230
- /// let mut map: HashMap<uint, String> = HashMap::new();
1231
- /// map.insert(1u, "foo".to_string());
1232
- /// let s: String = map.find_copy(&1).unwrap();
1233
- /// ```
1225
+ /// Return a copy of the value corresponding to the key.
1226
+ #[ deprecated = "Use `map.get(k).cloned()`" ]
1234
1227
pub fn find_copy ( & self , k : & K ) -> Option < V > {
1235
- self . get ( k) . map ( |v| ( * v ) . clone ( ) )
1228
+ self . get ( k) . cloned ( )
1236
1229
}
1237
1230
1238
- /// Return a copy of the value corresponding to the key .
1231
+ /// Deprecated: Use `map[k].clone()` .
1239
1232
///
1240
- /// # Panics
1241
- ///
1242
- /// Panics if the key is not present.
1243
- ///
1244
- /// # Example
1245
- ///
1246
- /// ```
1247
- /// use std::collections::HashMap;
1248
- ///
1249
- /// let mut map: HashMap<uint, String> = HashMap::new();
1250
- /// map.insert(1u, "foo".to_string());
1251
- /// let s: String = map.get_copy(&1);
1252
- /// ```
1233
+ /// Return a copy of the value corresponding to the key.
1234
+ #[ deprecated = "Use `map[k].clone()`" ]
1253
1235
pub fn get_copy ( & self , k : & K ) -> V {
1254
1236
self [ * k] . clone ( )
1255
1237
}
0 commit comments