Bug 1475691 - Fix tidy issues. r=me
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 18 Sep 2018 11:44:47 +0200
changeset 495396 88d411b26b2c2d5feb17ea7ebd270e685e7a7bfc
parent 495395 12202cbf73b7b2786dcc914c782d6aba44a542e6
child 495397 951aded247b715ec88e086a86b916907e051ea51
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1475691
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1475691 - Fix tidy issues. r=me
servo/components/selectors/tree.rs
servo/components/servo_arc/lib.rs
servo/components/style/properties/cascade.rs
--- a/servo/components/selectors/tree.rs
+++ b/servo/components/selectors/tree.rs
@@ -17,17 +17,17 @@ use std::ptr::NonNull;
 pub struct OpaqueElement(NonNull<()>);
 
 unsafe impl Send for OpaqueElement {}
 
 impl OpaqueElement {
     /// Creates a new OpaqueElement from an arbitrarily-typed pointer.
     pub fn new<T>(ptr: &T) -> Self {
         unsafe {
-            OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))    
+            OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))
         }
     }
 }
 
 pub trait Element: Sized + Clone + Debug {
     type Impl: SelectorImpl;
 
     /// Converts self into an opaque representation.
--- a/servo/components/servo_arc/lib.rs
+++ b/servo/components/servo_arc/lib.rs
@@ -164,17 +164,17 @@ impl<T> Arc<T> {
                 p: ptr::NonNull::new_unchecked(Box::into_raw(x)),
             }
         }
     }
 
     /// Convert the Arc<T> to a raw pointer, suitable for use across FFI
     ///
     /// Note: This returns a pointer to the data T, which is offset in the allocation.
-    /// 
+    ///
     /// It is recommended to use RawOffsetArc for this.
     #[inline]
     fn into_raw(this: Self) -> *const T {
         let ptr = unsafe { &((*this.ptr()).data) as *const _ };
         mem::forget(this);
         ptr
     }
 
@@ -307,17 +307,17 @@ impl<T: ?Sized> Deref for Arc<T> {
 
 impl<T: Clone> Arc<T> {
     /// Makes a mutable reference to the `Arc`, cloning if necessary
     ///
     /// This is functionally equivalent to [`Arc::make_mut`][mm] from the standard library.
     ///
     /// If this `Arc` is uniquely owned, `make_mut()` will provide a mutable
     /// reference to the contents. If not, `make_mut()` will create a _new_ `Arc`
-    /// with a copy of the contents, update `this` to point to it, and provide 
+    /// with a copy of the contents, update `this` to point to it, and provide
     /// a mutable reference to its contents.
     ///
     /// This is useful for implementing copy-on-write schemes where you wish to
     /// avoid copying things if your `Arc` is not shared.
     ///
     /// [mm]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.make_mut
     #[inline]
     pub fn make_mut(this: &mut Self) -> &mut T {
@@ -697,19 +697,21 @@ impl<H, T> ThinArc<H, T> {
     /// Temporarily converts |self| into a bonafide Arc and exposes it to the
     /// provided callback. The refcount is not modified.
     #[inline]
     pub fn with_arc<F, U>(&self, f: F) -> U
     where
         F: FnOnce(&Arc<HeaderSliceWithLength<H, [T]>>) -> U,
     {
         // Synthesize transient Arc, which never touches the refcount of the ArcInner.
-        let transient = unsafe { NoDrop::new(Arc {
-            p: ptr::NonNull::new_unchecked(thin_to_thick(self.ptr)),
-        })};
+        let transient = unsafe {
+            NoDrop::new(Arc {
+                p: ptr::NonNull::new_unchecked(thin_to_thick(self.ptr)),
+            })
+        };
 
         // Expose the transient Arc to the callback, which may clone it if it wants.
         let result = f(&transient);
 
         // Forget the transient Arc to leave the refcount untouched.
         // XXXManishearth this can be removed when unions stabilize,
         // since then NoDrop becomes zero overhead
         mem::forget(transient);
@@ -717,17 +719,17 @@ impl<H, T> ThinArc<H, T> {
         // Forward the result.
         result
     }
 
     /// Creates a `ThinArc` for a HeaderSlice using the given header struct and
     /// iterator to generate the slice.
     pub fn from_header_and_iter<I>(header: H, items: I) -> Self
     where
-        I: Iterator<Item = T> + ExactSizeIterator
+        I: Iterator<Item = T> + ExactSizeIterator,
     {
         let header = HeaderWithLength::new(header, items.len());
         Arc::into_thin(Arc::from_header_and_iter(header, items))
     }
 
     /// Returns the address on the heap of the ThinArc itself -- not the T
     /// within it -- for memory reporting.
     #[inline]
@@ -1051,17 +1053,16 @@ pub struct ArcUnion<A, B> {
     p: ptr::NonNull<()>,
     phantom_a: PhantomData<A>,
     phantom_b: PhantomData<B>,
 }
 
 unsafe impl<A: Sync + Send, B: Send + Sync> Send for ArcUnion<A, B> {}
 unsafe impl<A: Sync + Send, B: Send + Sync> Sync for ArcUnion<A, B> {}
 
-
 impl<A: PartialEq, B: PartialEq> PartialEq for ArcUnion<A, B> {
     fn eq(&self, other: &Self) -> bool {
         use ArcUnionBorrow::*;
         match (self.borrow(), other.borrow()) {
             (First(x), First(y)) => x == y,
             (Second(x), Second(y)) => x == y,
             (_, _) => false,
         }
@@ -1099,26 +1100,22 @@ impl<A, B> ArcUnion<A, B> {
             let ptr = ((self.p.as_ptr() as usize) & !0x1) as *const B;
             let borrow = unsafe { ArcBorrow::from_ref(&*ptr) };
             ArcUnionBorrow::Second(borrow)
         }
     }
 
     /// Creates an `ArcUnion` from an instance of the first type.
     pub fn from_first(other: Arc<A>) -> Self {
-        unsafe {
-            Self::new(Arc::into_raw(other) as *mut _)
-        }
+        unsafe { Self::new(Arc::into_raw(other) as *mut _) }
     }
 
     /// Creates an `ArcUnion` from an instance of the second type.
     pub fn from_second(other: Arc<B>) -> Self {
-        unsafe {
-            Self::new(((Arc::into_raw(other) as usize) | 0x1) as *mut _)
-        }
+        unsafe { Self::new(((Arc::into_raw(other) as usize) | 0x1) as *mut _) }
     }
 
     /// Returns true if this `ArcUnion` contains the first type.
     pub fn is_first(&self) -> bool {
         self.p.as_ptr() as usize & 0x1 == 0
     }
 
     /// Returns true if this `ArcUnion` contains the second type.
--- a/servo/components/style/properties/cascade.rs
+++ b/servo/components/style/properties/cascade.rs
@@ -8,17 +8,16 @@ use context::QuirksMode;
 use custom_properties::CustomPropertiesBuilder;
 use dom::TElement;
 use font_metrics::FontMetricsProvider;
 use logical_geometry::WritingMode;
 use media_queries::Device;
 use properties::{ComputedValues, StyleBuilder};
 use properties::{LonghandId, LonghandIdSet};
 use properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
-use properties::{CSSWideKeyword, WideKeywordDeclaration};
 use properties::CASCADE_PROPERTY;
 use rule_cache::{RuleCache, RuleCacheConditions};
 use rule_tree::{CascadeLevel, StrongRuleNode};
 use selector_parser::PseudoElement;
 use servo_arc::Arc;
 use shared_lock::StylesheetGuards;
 use smallbitvec::SmallBitVec;
 use std::borrow::Cow;
@@ -785,16 +784,18 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
         } else {
             #[cfg(feature = "gecko")]
             {
                 if self.seen.contains(LonghandId::XLang) ||
                     self.seen.contains(LonghandId::MozScriptLevel) ||
                     self.seen.contains(LonghandId::MozMinFontSizeRatio) ||
                     self.seen.contains(LonghandId::FontFamily)
                 {
+                    use properties::{CSSWideKeyword, WideKeywordDeclaration};
+
                     // font-size must be explicitly inherited to handle lang
                     // changes and scriptlevel changes.
                     //
                     // FIXME(emilio): That looks a bit bogus...
                     let inherit = PropertyDeclaration::CSSWideKeyword(WideKeywordDeclaration {
                         id: LonghandId::FontSize,
                         keyword: CSSWideKeyword::Inherit,
                     });