We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e06eb1c commit 76d54dbCopy full SHA for 76d54db
src/lib.rs
@@ -174,7 +174,9 @@ fn merge_styles(existing_style: &str, new_styles: &[Declaration]) -> Result<Stri
174
let declarations =
175
cssparser::DeclarationListParser::new(&mut parser, parse::CSSDeclarationListParser);
176
// Merge existing with the new ones
177
- let mut styles: HashMap<String, String> = HashMap::new();
+ // We know that at least one rule already exists, so we add 1
178
+ let mut styles: HashMap<String, String> =
179
+ HashMap::with_capacity(new_styles.len().saturating_add(1));
180
for declaration in declarations.into_iter() {
181
let (property, value) = declaration?;
182
styles.insert(property, value);
0 commit comments