Auto merge of #17967 - jdm:parsefun, r=SimonSapin

CSS parsing optimizations

These address some small inefficiencies that showed up while profiling the myspace talos test.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17967)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-04 02:10:05 -05:00 committed by GitHub
commit aef95cf195
2 changed files with 12 additions and 13 deletions

View file

@ -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.