]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/collections/hash/map.rs
Remove the Recover trait for HashSet
[rust.git] / src / libstd / collections / hash / map.rs
index ac3cfde47b5202033e8be90378258ed6a7183043..e24a824e38807186d09caa310a1a194d19d90d69 100644 (file)
@@ -2937,13 +2937,6 @@ pub fn remove(self) -> V {
         pop_internal(self.elem).1
     }
 
-    /// Returns a key that was used for search.
-    ///
-    /// The key was retained for further use.
-    fn take_key(&mut self) -> Option<K> {
-        self.key.take()
-    }
-
     /// Replaces the entry, returning the old key and value. The new key in the hash map will be
     /// the key used to create this entry.
     ///
@@ -3262,39 +3255,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     }
 }
 
-impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
-    where K: Eq + Hash + Borrow<Q>,
-          S: BuildHasher,
-          Q: Eq + Hash
-{
-    type Key = K;
-
-    #[inline]
-    fn get(&self, key: &Q) -> Option<&K> {
-        self.search(key).map(|bucket| bucket.into_refs().0)
-    }
-
-    fn take(&mut self, key: &Q) -> Option<K> {
-        self.search_mut(key).map(|bucket| pop_internal(bucket).0)
-    }
-
-    #[inline]
-    fn replace(&mut self, key: K) -> Option<K> {
-        self.reserve(1);
-
-        match self.entry(key) {
-            Occupied(mut occupied) => {
-                let key = occupied.take_key().unwrap();
-                Some(mem::replace(occupied.elem.read_mut().0, key))
-            }
-            Vacant(vacant) => {
-                vacant.insert(());
-                None
-            }
-        }
-    }
-}
-
 #[allow(dead_code)]
 fn assert_covariance() {
     fn map_key<'new>(v: HashMap<&'static str, u8>) -> HashMap<&'new str, u8> {