about summary refs log tree commit diff
path: root/src/libstd/hashmap.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2013-07-25 04:02:08 -0400
committerSteven Fackler <sfackler@gmail.com>2013-07-25 15:17:30 -0700
commitfeb18fe8daa3952718c29039ec792d5e69d1276f (patch)
treec3d3d6143b8ae1c9765033a29b193f85dc0dd860 /src/libstd/hashmap.rs
parentb1f5b1ba5fd12a058d153e9da8f11cd1bc597bf0 (diff)
Added default impls for container methods
A couple of implementations of Container::is_empty weren't exactly
self.len() == 0 so I left them alone (e.g. Treemap).
Diffstat (limited to 'src/libstd/hashmap.rs')
-rw-r--r--src/libstd/hashmap.rs19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index deeda501942..6bef110bfe5 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -282,9 +282,6 @@ impl<K:Hash + Eq,V> HashMap<K, V> {
 impl<K:Hash + Eq,V> Container for HashMap<K, V> {
     /// Return the number of elements in the map
     fn len(&self) -> uint { self.size }
-
-    /// Return true if the map contains no elements
-    fn is_empty(&self) -> bool { self.len() == 0 }
 }
 
 impl<K:Hash + Eq,V> Mutable for HashMap<K, V> {
@@ -325,19 +322,6 @@ impl<K:Hash + Eq,V> MutableMap<K, V> for HashMap<K, V> {
         Some(self.mut_value_for_bucket(idx))
     }
 
-    /// Insert a key-value pair into the map. An existing value for a
-    /// key is replaced by the new value. Return true if the key did
-    /// not already exist in the map.
-    fn insert(&mut self, k: K, v: V) -> bool {
-        self.swap(k, v).is_none()
-    }
-
-    /// Remove a key-value pair from the map. Return true if the key
-    /// was present in the map, otherwise false.
-    fn remove(&mut self, k: &K) -> bool {
-        self.pop(k).is_some()
-    }
-
     /// Insert a key-value pair from the map. If the key already had a value
     /// present in the map, that value is returned. Otherwise None is returned.
     fn swap(&mut self, k: K, v: V) -> Option<V> {
@@ -661,9 +645,6 @@ impl<T:Hash + Eq> Eq for HashSet<T> {
 impl<T:Hash + Eq> Container for HashSet<T> {
     /// Return the number of elements in the set
     fn len(&self) -> uint { self.map.len() }
-
-    /// Return true if the set contains no elements
-    fn is_empty(&self) -> bool { self.map.is_empty() }
 }
 
 impl<T:Hash + Eq> Mutable for HashSet<T> {