]> git.lizzy.rs Git - rust.git/commitdiff
Don't create HashMap<K, V> when not needed
authorAaron Hill <aa1ronham@gmail.com>
Wed, 10 Apr 2019 03:36:27 +0000 (23:36 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Wed, 10 Apr 2019 03:36:27 +0000 (23:36 -0400)
tests/run-pass/hashmap.rs

index a95f7170aa1b1417e834d18a14766e19e98a9ab5..b29b681939794e19a029e46b80c1913c93862265 100644 (file)
@@ -27,13 +27,12 @@ fn test_map<S: BuildHasher>(mut map: HashMap<i32, i32, S>) {
 }
 
 fn main() {
-    let _map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default();
-
     // TODO: Implement random number generation on OS X
     if cfg!(not(target_os = "macos")) {
         let map_normal: HashMap<i32, i32> = HashMap::new();
         test_map(map_normal);
     } else {
-        test_map(_map);
+        let map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default();
+        test_map(map);
     }
 }