From 7861ec1d5bd55148e130aad3001b5c0b7160292c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 30 Oct 2017 12:33:44 +0100 Subject: [PATCH] style: Make the SelectorMap API slightly nicer. --- components/style/invalidation/element/collector.rs | 4 ++-- components/style/selector_map.rs | 6 +++--- components/style/stylist.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/style/invalidation/element/collector.rs b/components/style/invalidation/element/collector.rs index 31b93f8c732..9b697b76868 100644 --- a/components/style/invalidation/element/collector.rs +++ b/components/style/invalidation/element/collector.rs @@ -341,7 +341,7 @@ where self.quirks_mode, self.removed_id, self.classes_removed, - &mut |dependency| { + |dependency| { self.scan_dependency(dependency, VisitedDependent::No); true }, @@ -358,7 +358,7 @@ where self.quirks_mode, self.removed_id, self.classes_removed, - &mut |dependency| { + |dependency| { if !dependency.state.intersects(state_changes) { return true; } diff --git a/components/style/selector_map.rs b/components/style/selector_map.rs index c86053e8186..e3acda567f2 100644 --- a/components/style/selector_map.rs +++ b/components/style/selector_map.rs @@ -294,7 +294,7 @@ impl SelectorMap { /// FIXME(bholley) This overlaps with SelectorMap::get_all_matching_rules, /// but that function is extremely hot and I'd rather not rearrange it. #[inline] - pub fn lookup<'a, E, F>(&'a self, element: E, quirks_mode: QuirksMode, f: &mut F) -> bool + pub fn lookup<'a, E, F>(&'a self, element: E, quirks_mode: QuirksMode, mut f: F) -> bool where E: TElement, F: FnMut(&'a T) -> bool @@ -361,14 +361,14 @@ impl SelectorMap { quirks_mode: QuirksMode, additional_id: Option<&Atom>, additional_classes: &[Atom], - f: &mut F, + mut f: F, ) -> bool where E: TElement, F: FnMut(&'a T) -> bool { // Do the normal lookup. - if !self.lookup(element, quirks_mode, f) { + if !self.lookup(element, quirks_mode, |entry| f(entry)) { return false; } diff --git a/components/style/stylist.rs b/components/style/stylist.rs index acdb19da98b..687a05036d2 100644 --- a/components/style/stylist.rs +++ b/components/style/stylist.rs @@ -1475,7 +1475,7 @@ impl Stylist { data.selectors_for_cache_revalidation.lookup( element, self.quirks_mode, - &mut |selector_and_hashes| { + |selector_and_hashes| { results.push(matches_selector( &selector_and_hashes.selector, selector_and_hashes.selector_offset, @@ -1493,7 +1493,7 @@ impl Stylist { stylist.cascade_data.author.selectors_for_cache_revalidation.lookup( element, stylist.quirks_mode, - &mut |selector_and_hashes| { + |selector_and_hashes| { results.push(matches_selector( &selector_and_hashes.selector, selector_and_hashes.selector_offset,