From 01e5741ee77e0e3399f09d2cfee0b7d66f13666d Mon Sep 17 00:00:00 2001 From: tison Date: Fri, 26 Apr 2024 22:15:43 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: LFC <990479+MichaelScofield@users.noreply.github.com> --- src/sql/src/statements/option_map.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sql/src/statements/option_map.rs b/src/sql/src/statements/option_map.rs index 3ed0b8886802..abb628012fa7 100644 --- a/src/sql/src/statements/option_map.rs +++ b/src/sql/src/statements/option_map.rs @@ -56,7 +56,7 @@ impl OptionMap { } pub fn to_str_map(&self) -> HashMap<&str, &str> { - let mut map = HashMap::new(); + let mut map = HashMap::with_capacity(self.len()); map.extend(self.options.iter().map(|(k, v)| (k.as_str(), v.as_str()))); map.extend( self.secrets @@ -67,7 +67,8 @@ impl OptionMap { } pub fn into_map(self) -> HashMap { - let mut map = self.options; + let mut map = HashMap::with_capacity(self.len()); + map.extend(self.options); map.extend( self.secrets .into_iter()