Preallocate escaped CSS strings.

This commit is contained in:
Josh Matthews 2017-08-03 12:04:27 -04:00
parent e8e43e5b0c
commit 886e393511

View file

@ -77,7 +77,7 @@ fn escape_css_ident(ident: &str) -> String {
return ident.into() return ident.into()
} }
let mut escaped = String::new(); let mut escaped = String::with_capacity(ident.len());
// A leading dash does not need to be escaped as long as it is not the // A leading dash does not need to be escaped as long as it is not the
// *only* character in the identifier. // *only* character in the identifier.