diff options
| author | Stepan Koltsov <stepan.koltsov@gmail.com> | 2013-08-03 05:54:05 +0400 |
|---|---|---|
| committer | Stepan Koltsov <stepan.koltsov@gmail.com> | 2013-08-03 05:54:05 +0400 |
| commit | cf9e9b21d59eaf6f4d57904ef882a654caa37085 (patch) | |
| tree | 58a993b3762edb78f849bfd871f60339089d49a7 /src/libextra | |
| parent | 3ddc72f69be4d0a2027ff598ad262ea2b2ca3812 (diff) | |
Add default implementation of Map::contains_key function
Map::contains_key can be implemented with Map::find. Remove several implementations of contains_key.
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/smallintmap.rs | 5 | ||||
| -rw-r--r-- | src/libextra/treemap.rs | 5 |
2 files changed, 0 insertions, 10 deletions
diff --git a/src/libextra/smallintmap.rs b/src/libextra/smallintmap.rs index e939f42ac90..cbcb6adcbb0 100644 --- a/src/libextra/smallintmap.rs +++ b/src/libextra/smallintmap.rs @@ -46,11 +46,6 @@ impl<V> Mutable for SmallIntMap<V> { } impl<V> Map<uint, V> for SmallIntMap<V> { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, key: &uint) -> bool { - self.find(key).is_some() - } - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, key: &uint) -> Option<&'a V> { if *key < self.v.len() { diff --git a/src/libextra/treemap.rs b/src/libextra/treemap.rs index 82c7bf6caf1..094bf0e3d83 100644 --- a/src/libextra/treemap.rs +++ b/src/libextra/treemap.rs @@ -105,11 +105,6 @@ impl<K: TotalOrd, V> Mutable for TreeMap<K, V> { } impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> { - /// Return true if the map contains a value for the specified key - fn contains_key(&self, key: &K) -> bool { - self.find(key).is_some() - } - /// Return a reference to the value corresponding to the key fn find<'a>(&'a self, key: &K) -> Option<&'a V> { let mut current: &'a Option<~TreeNode<K, V>> = &self.root; |
