From 886e393511cc0a3c71e3a0605e25716fbdd5fd93 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 3 Aug 2017 12:04:27 -0400 Subject: [PATCH] Preallocate escaped CSS strings. --- ports/geckolib/error_reporter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/geckolib/error_reporter.rs b/ports/geckolib/error_reporter.rs index f13dc340a11..6b10077aa0f 100644 --- a/ports/geckolib/error_reporter.rs +++ b/ports/geckolib/error_reporter.rs @@ -77,7 +77,7 @@ fn escape_css_ident(ident: &str) -> String { 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 // *only* character in the identifier.