From 788a2ea1e4842754c2a6dab3b683ffd29c7b8d87 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Wed, 7 Feb 2018 16:03:08 +0300 Subject: [PATCH] with_capcity for HashSet --- src/validation/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation/mod.rs b/src/validation/mod.rs index 715f08e..8c87393 100644 --- a/src/validation/mod.rs +++ b/src/validation/mod.rs @@ -163,7 +163,7 @@ pub fn validate_module(module: Module) -> Result { // validate export section if let Some(export_section) = module.export_section() { - let mut export_names = HashSet::new(); + let mut export_names = HashSet::with_capacity(export_section.entries().len()); for export in export_section.entries() { // HashSet::insert returns false if item already in set. let duplicate = export_names.insert(export.field()) == false;