diff --git a/rust/macros/src/lib.rs b/rust/macros/src/lib.rs index 135c24d..f117487 100644 --- a/rust/macros/src/lib.rs +++ b/rust/macros/src/lib.rs @@ -4,8 +4,7 @@ macro_rules! hashmap { (@count $($expr:expr),*) => (<[()]>::len(&[$(hashmap!(@discard $expr)),*])); ($($($key:expr => $expr:expr),+ $(,)?)?) => {{ let cap = hashmap!(@count $($($key),*)?); - let mut map = ::std::collections::HashMap::new(); - map.reserve(cap); + let mut map = ::std::collections::HashMap::with_capacity(cap); $($(map.insert($key, $expr);)*)? map }};