diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-01 22:33:39 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 09:34:04 -0500 |
| commit | 1971a24441dc3ba102bccafdf997dd06f3b5487a (patch) | |
| tree | c4d7f5dca99c2f935a9010accbe86976decd657c /src/libstd/collections | |
| parent | 6b116bedafe29b7876b95575451c92452a1ec72b (diff) | |
| download | rust-1971a24441dc3ba102bccafdf997dd06f3b5487a.tar.gz rust-1971a24441dc3ba102bccafdf997dd06f3b5487a.zip | |
std: fix fallout
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 28 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 32 | ||||
| -rw-r--r-- | src/libstd/collections/hash/table.rs | 24 |
3 files changed, 61 insertions, 23 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index d4fc4150fae..6450b149d02 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1423,37 +1423,49 @@ enum VacantEntryState<K, V, M> { } #[stable] -impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> { +impl<'a, K, V> Iterator for Iter<'a, K, V> { + type Item = (&'a K, &'a V); + #[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } #[stable] -impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> { +impl<'a, K, V> Iterator for IterMut<'a, K, V> { + type Item = (&'a K, &'a mut V); + #[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } #[stable] -impl<K, V> Iterator<(K, V)> for IntoIter<K, V> { +impl<K, V> Iterator for IntoIter<K, V> { + type Item = (K, V); + #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } #[stable] -impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> { +impl<'a, K, V> Iterator for Keys<'a, K, V> { + type Item = &'a K; + #[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } #[stable] -impl<'a, K, V> Iterator<&'a V> for Values<'a, K, V> { +impl<'a, K, V> Iterator for Values<'a, K, V> { + type Item = &'a V; + #[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() } } #[stable] -impl<'a, K: 'a, V: 'a> Iterator<(K, V)> for Drain<'a, K, V> { +impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> { + type Item = (K, V); + #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() @@ -1511,7 +1523,7 @@ impl<'a, K, V> VacantEntry<'a, K, V> { #[stable] impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> { - fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> { + fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> HashMap<K, V, H> { let lower = iter.size_hint().0; let mut map = HashMap::with_capacity_and_hasher(lower, Default::default()); map.extend(iter); @@ -1521,7 +1533,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for Has #[stable] impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Extend<(K, V)> for HashMap<K, V, H> { - fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) { + fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) { for (k, v) in iter { self.insert(k, v); } diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 6132d288da2..ea8298c48c8 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -603,7 +603,7 @@ impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> { #[stable] impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> { - fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> { + fn from_iter<I: Iterator<Item=T>>(iter: I) -> HashSet<T, H> { let lower = iter.size_hint().0; let mut set = HashSet::with_capacity_and_hasher(lower, Default::default()); set.extend(iter); @@ -613,7 +613,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, #[stable] impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extend<T> for HashSet<T, H> { - fn extend<I: Iterator<T>>(&mut self, mut iter: I) { + fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) { for k in iter { self.insert(k); } @@ -789,27 +789,35 @@ pub struct Union<'a, T: 'a, H: 'a> { } #[stable] -impl<'a, K> Iterator<&'a K> for Iter<'a, K> { +impl<'a, K> Iterator for Iter<'a, K> { + type Item = &'a K; + fn next(&mut self) -> Option<&'a K> { self.iter.next() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } } #[stable] -impl<K> Iterator<K> for IntoIter<K> { +impl<K> Iterator for IntoIter<K> { + type Item = K; + fn next(&mut self) -> Option<K> { self.iter.next() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } } #[stable] -impl<'a, K: 'a> Iterator<K> for Drain<'a, K> { +impl<'a, K: 'a> Iterator for Drain<'a, K> { + type Item = K; + fn next(&mut self) -> Option<K> { self.iter.next() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } } #[stable] -impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H> +impl<'a, T, S, H> Iterator for Intersection<'a, T, H> where T: Eq + Hash<S>, H: Hasher<S> { + type Item = &'a T; + fn next(&mut self) -> Option<&'a T> { loop { match self.iter.next() { @@ -828,9 +836,11 @@ impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H> } #[stable] -impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H> +impl<'a, T, S, H> Iterator for Difference<'a, T, H> where T: Eq + Hash<S>, H: Hasher<S> { + type Item = &'a T; + fn next(&mut self) -> Option<&'a T> { loop { match self.iter.next() { @@ -849,17 +859,21 @@ impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H> } #[stable] -impl<'a, T, S, H> Iterator<&'a T> for SymmetricDifference<'a, T, H> +impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, H> where T: Eq + Hash<S>, H: Hasher<S> { + type Item = &'a T; + fn next(&mut self) -> Option<&'a T> { self.iter.next() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } } #[stable] -impl<'a, T, S, H> Iterator<&'a T> for Union<'a, T, H> +impl<'a, T, S, H> Iterator for Union<'a, T, H> where T: Eq + Hash<S>, H: Hasher<S> { + type Item = &'a T; + fn next(&mut self) -> Option<&'a T> { self.iter.next() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() } } diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index a687ba3da8d..2b999d83a98 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -730,7 +730,9 @@ impl<'a, K, V> Clone for RawBuckets<'a, K, V> { } -impl<'a, K, V> Iterator<RawBucket<K, V>> for RawBuckets<'a, K, V> { +impl<'a, K, V> Iterator for RawBuckets<'a, K, V> { + type Item = RawBucket<K, V>; + fn next(&mut self) -> Option<RawBucket<K, V>> { while self.raw.hash != self.hashes_end { unsafe { @@ -757,7 +759,9 @@ struct RevMoveBuckets<'a, K, V> { marker: marker::ContravariantLifetime<'a>, } -impl<'a, K, V> Iterator<(K, V)> for RevMoveBuckets<'a, K, V> { +impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> { + type Item = (K, V); + fn next(&mut self) -> Option<(K, V)> { if self.elems_left == 0 { return None; @@ -816,7 +820,9 @@ pub struct Drain<'a, K: 'a, V: 'a> { iter: RawBuckets<'static, K, V>, } -impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> { +impl<'a, K, V> Iterator for Iter<'a, K, V> { + type Item = (&'a K, &'a V); + fn next(&mut self) -> Option<(&'a K, &'a V)> { self.iter.next().map(|bucket| { self.elems_left -= 1; @@ -832,7 +838,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> { } } -impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> { +impl<'a, K, V> Iterator for IterMut<'a, K, V> { + type Item = (&'a K, &'a mut V); + fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.iter.next().map(|bucket| { self.elems_left -= 1; @@ -848,7 +856,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> { } } -impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> { +impl<K, V> Iterator for IntoIter<K, V> { + type Item = (SafeHash, K, V); + fn next(&mut self) -> Option<(SafeHash, K, V)> { self.iter.next().map(|bucket| { self.table.size -= 1; @@ -870,7 +880,9 @@ impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> { } } -impl<'a, K: 'a, V: 'a> Iterator<(SafeHash, K, V)> for Drain<'a, K, V> { +impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> { + type Item = (SafeHash, K, V); + #[inline] fn next(&mut self) -> Option<(SafeHash, K, V)> { self.iter.next().map(|bucket| { |
