@@ -1220,36 +1220,18 @@ fn search_entry_hashed<'a, K: Eq, V>(table: &'a mut RawTable<K,V>, hash: SafeHas
12201220}
12211221
12221222impl < 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()`.
12261224 ///
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()`" ]
12341227 pub fn find_copy ( & self , k : & K ) -> Option < V > {
1235- self . get ( k) . map ( |v| ( * v ) . clone ( ) )
1228+ self . get ( k) . cloned ( )
12361229 }
12371230
1238- /// Return a copy of the value corresponding to the key .
1231+ /// Deprecated: Use `map[k].clone()` .
12391232 ///
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()`" ]
12531235 pub fn get_copy ( & self , k : & K ) -> V {
12541236 self [ * k] . clone ( )
12551237 }
0 commit comments