mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Don't create HashMap<K, V> when not needed
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user