aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/bloom.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2018-04-10 17:35:15 -0700
committerBobby Holley <bobbyholley@gmail.com>2018-04-10 17:35:15 -0700
commitc99bcdd4b8d4b4ac495d8a26eb8a4d2c710a2589 (patch)
tree26f5f8242e9de1b27166571c56ae03f22a22270d /components/style/bloom.rs
parentf7ae1a37e3e004e156e5833551c486a7a5f189a0 (diff)
downloadservo-c99bcdd4b8d4b4ac495d8a26eb8a4d2c710a2589.tar.gz
servo-c99bcdd4b8d4b4ac495d8a26eb8a4d2c710a2589.zip
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
Diffstat (limited to 'components/style/bloom.rs')
-rw-r--r--components/style/bloom.rs45
1 files changed, 25 insertions, 20 deletions
diff --git a/components/style/bloom.rs b/components/style/bloom.rs
index 83063e194c7..613cbde4999 100644
--- a/components/style/bloom.rs
+++ b/components/style/bloom.rs
@@ -7,7 +7,7 @@
#![deny(missing_docs)]
-use atomic_refcell::{AtomicRefMut, AtomicRefCell};
+use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use dom::{SendElement, TElement};
use owning_ref::OwningHandle;
use selectors::bloom::BloomFilter;
@@ -105,9 +105,7 @@ where
f(id.get_hash());
}
- element.each_class(|class| {
- f(class.get_hash())
- });
+ element.each_class(|class| f(class.get_hash()));
}
impl<E: TElement> Drop for StyleBloom<E> {
@@ -129,8 +127,12 @@ impl<E: TElement> StyleBloom<E> {
#[inline(never)]
pub fn new() -> Self {
let bloom_arc = BLOOM_KEY.with(|b| b.clone());
- let filter = OwningHandle::new_with_fn(bloom_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut());
- debug_assert!(filter.is_zeroed(), "Forgot to zero the bloom filter last time");
+ let filter =
+ OwningHandle::new_with_fn(bloom_arc, |x| unsafe { x.as_ref() }.unwrap().borrow_mut());
+ debug_assert!(
+ filter.is_zeroed(),
+ "Forgot to zero the bloom filter last time"
+ );
StyleBloom {
filter: filter,
elements: Default::default(),
@@ -169,7 +171,10 @@ impl<E: TElement> StyleBloom<E> {
/// Pop the last element in the bloom filter and return it.
#[inline]
fn pop(&mut self) -> Option<E> {
- let PushedElement { element, num_hashes } = self.elements.pop()?;
+ let PushedElement {
+ element,
+ num_hashes,
+ } = self.elements.pop()?;
let popped_element = *element;
// Verify that the pushed hashes match the ones we'd get from the element.
@@ -237,7 +242,10 @@ impl<E: TElement> StyleBloom<E> {
if cfg!(debug_assertions) {
let mut checked = 0;
while let Some(parent) = element.traversal_parent() {
- assert_eq!(parent, *(self.elements[self.elements.len() - 1 - checked].element));
+ assert_eq!(
+ parent,
+ *(self.elements[self.elements.len() - 1 - checked].element)
+ );
element = parent;
checked += 1;
}
@@ -261,10 +269,7 @@ impl<E: TElement> StyleBloom<E> {
///
/// Returns the new bloom filter depth, that the traversal code is
/// responsible to keep around if it wants to get an effective filter.
- pub fn insert_parents_recovering(&mut self,
- element: E,
- element_depth: usize)
- {
+ pub fn insert_parents_recovering(&mut self, element: E, element_depth: usize) {
// Easy case, we're in a different restyle, or we're empty.
if self.elements.is_empty() {
self.rebuild(element);
@@ -277,7 +282,7 @@ impl<E: TElement> StyleBloom<E> {
// Yay, another easy case.
self.clear();
return;
- }
+ },
};
if self.current_parent() == Some(traversal_parent) {
@@ -291,10 +296,11 @@ impl<E: TElement> StyleBloom<E> {
}
// We should've early exited above.
- debug_assert!(element_depth != 0,
- "We should have already cleared the bloom filter");
- debug_assert!(!self.elements.is_empty(),
- "How! We should've just rebuilt!");
+ debug_assert!(
+ element_depth != 0,
+ "We should have already cleared the bloom filter"
+ );
+ debug_assert!(!self.elements.is_empty(), "How! We should've just rebuilt!");
// Now the fun begins: We have the depth of the dom and the depth of the
// last element inserted in the filter, let's try to find a common
@@ -327,8 +333,7 @@ impl<E: TElement> StyleBloom<E> {
// TODO(emilio): Seems like we could insert parents here, then
// reverse the slice.
parents_to_insert.push(common_parent);
- common_parent =
- common_parent.traversal_parent().expect("We were lied to");
+ common_parent = common_parent.traversal_parent().expect("We were lied to");
common_parent_depth -= 1;
}
@@ -359,7 +364,7 @@ impl<E: TElement> StyleBloom<E> {
} else {
panic!("should have found a common ancestor");
}
- }
+ },
}
}