diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-08-30 12:54:50 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-08-31 16:21:47 -0700 |
| commit | 4128cc4cb44acb415be3cfdfa008fd6c95ceee74 (patch) | |
| tree | 321c8c7ed1c28247377bf4122365c047d69f891f /src/libstd/map.rs | |
| parent | 638db28c472c1edadc3c37f900df28f14cca7665 (diff) | |
| download | rust-4128cc4cb44acb415be3cfdfa008fd6c95ceee74.tar.gz rust-4128cc4cb44acb415be3cfdfa008fd6c95ceee74.zip | |
Make utility funs in core::int, core::uint, etc. not by-reference
Closes #3302
Diffstat (limited to 'src/libstd/map.rs')
| -rw-r--r-- | src/libstd/map.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 2a2e6b5efc6..f2dfb3200f3 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -426,12 +426,12 @@ fn bytes_hash<V: copy>() -> hashmap<~[u8], V> { /// Construct a hashmap for int keys fn int_hash<V: copy>() -> hashmap<int, V> { - return hashmap(int::hash, int::eq); + return hashmap(|x| { int::hash(*x) }, |x, y| { int::eq(*x, *y)}); } /// Construct a hashmap for uint keys fn uint_hash<V: copy>() -> hashmap<uint, V> { - return hashmap(uint::hash, uint::eq); + return hashmap(|x| { uint::hash(*x) }, |x, y| { uint::eq(*x, *y) } ); } /// Convenience function for adding keys to a hashmap with nil type keys @@ -473,15 +473,15 @@ fn hash_from_bytes<V: copy>(items: &[(~[u8], V)]) -> hashmap<~[u8], V> { /// Construct a hashmap from a vector with int keys fn hash_from_ints<V: copy>(items: &[(int, V)]) -> hashmap<int, V> { - hash_from_vec(int::hash, int::eq, items) + hash_from_vec(|x| { int::hash(*x) }, |x, y| { int::eq(*x, *y) }, items) } /// Construct a hashmap from a vector with uint keys fn hash_from_uints<V: copy>(items: &[(uint, V)]) -> hashmap<uint, V> { - hash_from_vec(uint::hash, uint::eq, items) + hash_from_vec(|x| { uint::hash(*x) }, |x, y| { uint::eq(*x, *y) } , items) } -// XXX Transitionary +// XXX Transitional impl<K: Eq IterBytes Hash copy, V: copy> Managed<LinearMap<K, V>>: map<K, V> { pure fn size() -> uint { |
