Skip to content

Commit

Permalink
with_capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 17, 2023
1 parent f699a73 commit b0eb216
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nexus/analyzer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<'a> StatementAnalyzer for PeerDDLAnalyzer<'a> {
}

// get do_initial_copy from with_options
let mut raw_options = HashMap::new();
let mut raw_options = HashMap::with_capacity(cdc.with_options.len());
for option in &cdc.with_options {
raw_options.insert(&option.name.value as &str, &option.value);
}
Expand Down Expand Up @@ -362,7 +362,7 @@ impl<'a> StatementAnalyzer for PeerDDLAnalyzer<'a> {
}))
}
Select(select) => {
let mut raw_options = HashMap::new();
let mut raw_options = HashMap::with_capacity(select.with_options.len());
for option in &select.with_options {
raw_options.insert(&option.name.value as &str, &option.value);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ impl<'a> StatementAnalyzer for PeerDDLAnalyzer<'a> {
mirror_name,
with_options,
} => {
let mut raw_options = HashMap::new();
let mut raw_options = HashMap::with_capacity(with_options.len());
for option in with_options {
raw_options.insert(&option.name.value as &str, &option.value);
}
Expand Down Expand Up @@ -511,7 +511,7 @@ fn parse_db_options(
db_type: DbType,
with_options: &[SqlOption],
) -> anyhow::Result<Option<Config>> {
let mut opts: HashMap<&str, &str> = HashMap::new();
let mut opts: HashMap<&str, &str> = HashMap::with_capacity(with_options.len());
for opt in with_options {
let val = match opt.value {
sqlparser::ast::Value::SingleQuotedString(ref str) => str,
Expand Down

0 comments on commit b0eb216

Please sign in to comment.