Reserve more capacity for escaped key

This commit is contained in:
Nick Rolfe
2021-05-05 13:21:16 +01:00
parent 99ae17de03
commit c37f390efc

View File

@@ -208,7 +208,7 @@ fn escape_key<'a, S: Into<Cow<'a, str>>>(key: S) -> Cow<'a, str> {
let key = key.into();
if key.contains(needs_escaping) {
let mut escaped = String::with_capacity(key.len());
let mut escaped = String::with_capacity(2 * key.len());
for c in key.chars() {
match c {
'&' => escaped.push_str("&amp;"),