Auto merge of #19558 - emilio:sadness, r=heycam

selectors: Manually inline any(..) in matches_selector_list.

Since the compiler refuses to inline the inner closure even with -O3, which is
sad :(.

Sad try run:

  https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=c2724c47e98f990826327da05220cd83b772d144&newProject=try&newRevision=52ac88b40a08a5ef6a629bd681f2e5a444b75f54&framework=1

<!-- 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/19558)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-12-14 10:19:23 -06:00 committed by GitHub
commit 370f5acf6d

View file

@ -72,14 +72,24 @@ pub fn matches_selector_list<E>(
where where
E: Element E: Element
{ {
selector_list.0.iter().any(|selector| { // This is pretty much any(..) but manually inlined because the compiler
matches_selector(selector, // refuses to do so from querySelector / querySelectorAll.
0, for selector in &selector_list.0 {
None, let matches = matches_selector(
element, selector,
context, 0,
&mut |_, _| {}) None,
}) element,
context,
&mut |_, _| {},
);
if matches {
return true;
}
}
false
} }
#[inline(always)] #[inline(always)]