diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-02 14:28:35 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 17:03:44 -0500 |
| commit | d22acb77b219f1abe7265ea3a6d88017523a2d7e (patch) | |
| tree | b4fc9a578ce2091bf89c0ce113f8face1a901425 /src/libstd/collections/hash | |
| parent | 0fcd73037358b5f39276cf48f600299c44c7ccec (diff) | |
| download | rust-d22acb77b219f1abe7265ea3a6d88017523a2d7e.tar.gz rust-d22acb77b219f1abe7265ea3a6d88017523a2d7e.zip | |
libstd: fix fallout
Diffstat (limited to 'src/libstd/collections/hash')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 23 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 9 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index a8dce232d26..97e0518a072 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -852,7 +852,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn keys(&self) -> Keys<K, V> { - self.iter().map(|(k, _v)| k) + fn first<A, B>((a, _): (A, B)) -> A { a } + + self.iter().map(first) } /// An iterator visiting all values in arbitrary order. @@ -874,7 +876,9 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn values(&self) -> Values<K, V> { - self.iter().map(|(_k, v)| v) + fn second<A, B>((_, b): (A, B)) -> B { b } + + self.iter().map(second) } /// An iterator visiting all key-value pairs in arbitrary order. @@ -946,8 +950,10 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn into_iter(self) -> MoveEntries<K, V> { + fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) } + MoveEntries { - inner: self.table.into_iter().map(|(_, k, v)| (k, v)) + inner: self.table.into_iter().map(last_two) } } @@ -1316,7 +1322,12 @@ pub struct MutEntries<'a, K: 'a, V: 'a> { /// HashMap move iterator pub struct MoveEntries<K, V> { - inner: iter::Map<'static, (SafeHash, K, V), (K, V), table::MoveEntries<K, V>> + inner: iter::Map< + (SafeHash, K, V), + (K, V), + table::MoveEntries<K, V>, + fn((SafeHash, K, V)) -> (K, V), + > } /// A view into a single occupied location in a HashMap @@ -1434,11 +1445,11 @@ impl<'a, K, V> VacantEntry<'a, K, V> { /// HashMap keys iterator pub type Keys<'a, K, V> = - iter::Map<'static, (&'a K, &'a V), &'a K, Entries<'a, K, V>>; + iter::Map<(&'a K, &'a V), &'a K, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>; /// HashMap values iterator pub type Values<'a, K, V> = - iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>; + iter::Map<(&'a K, &'a V), &'a V, Entries<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>; 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> { diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index b3ccfdbb47c..5db7bd7fc48 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -277,7 +277,9 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> { /// ``` #[unstable = "matches collection reform specification, waiting for dust to settle"] pub fn into_iter(self) -> SetMoveItems<T> { - self.map.into_iter().map(|(k, _)| k) + fn first<A, B>((a, _): (A, B)) -> A { a } + + self.map.into_iter().map(first) } /// Visit the values representing the difference. @@ -611,11 +613,10 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Default for HashSet<T, H> { /// HashSet iterator pub type SetItems<'a, K> = - iter::Map<'static, (&'a K, &'a ()), &'a K, Entries<'a, K, ()>>; + iter::Map<(&'a K, &'a ()), &'a K, Entries<'a, K, ()>, fn((&'a K, &'a ())) -> &'a K>; /// HashSet move iterator -pub type SetMoveItems<K> = - iter::Map<'static, (K, ()), K, MoveEntries<K, ()>>; +pub type SetMoveItems<K> = iter::Map<(K, ()), K, MoveEntries<K, ()>, fn((K, ())) -> K>; // `Repeat` is used to feed the filter closure an explicit capture // of a reference to the other set |
