Bug 1521652 - Run rustfmt on servo/ports/geckolib/. r=emilio
authorCameron McCormack <cam@mcc.id.au>
Tue, 22 Jan 2019 01:59:21 +0000
changeset 454766 989238f82c8949cbdb9a664d93f9313c0b5ab8e2
parent 454765 c46ba0dfc91c8f734dc36f8c6faa5c9be0638a21
child 454767 c25d82a5b24c0b66321417121f6e1f80d8e62004
push id35413
push useropoprus@mozilla.com
push dateTue, 22 Jan 2019 09:38:06 +0000
treeherdermozilla-central@05c2a41b98c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1521652
milestone66.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 1521652 - Run rustfmt on servo/ports/geckolib/. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D17177
servo/ports/geckolib/error_reporter.rs
servo/ports/geckolib/glue.rs
servo/ports/geckolib/stylesheet_loader.rs
servo/ports/geckolib/tests/specified_values.rs
--- a/servo/ports/geckolib/error_reporter.rs
+++ b/servo/ports/geckolib/error_reporter.rs
@@ -241,24 +241,24 @@ impl<'a> ErrorHelpers<'a> for Contextual
                     ..
                 },
             ) => match *err {
                 StyleParseErrorKind::InvalidColor(_, _) => {
                     return (
                         Some(cstr!("PEColorNotColor")),
                         cstr!("PEValueParsingError"),
                         Action::Drop,
-                    )
+                    );
                 },
                 StyleParseErrorKind::InvalidFilter(_, _) => {
                     return (
                         Some(cstr!("PEExpectedNoneOrURLOrFilterFunction")),
                         cstr!("PEValueParsingError"),
                         Action::Drop,
-                    )
+                    );
                 },
                 StyleParseErrorKind::OtherInvalidValue(_) => {
                     (cstr!("PEValueParsingError"), Action::Drop)
                 },
                 _ => (cstr!("PEUnknownProperty"), Action::Drop),
             },
             ContextualParseError::UnsupportedPropertyDeclaration(..) => {
                 (cstr!("PEUnknownProperty"), Action::Drop)
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -804,17 +804,17 @@ pub extern "C" fn Servo_AnimationValue_G
     use style::values::computed::color::Color as ComputedColor;
 
     let value = AnimationValue::as_arc(&value);
     match **value {
         AnimationValue::BackgroundColor(color) => {
             let computed: ComputedColor = ToAnimatedValue::from_animated_value(color);
             let foreground_color = convert_nscolor_to_rgba(foreground_color);
             convert_rgba_to_nscolor(&computed.to_rgba(foreground_color))
-        }
+        },
         _ => panic!("Other color properties are not supported yet"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed) -> f32 {
     let value = AnimationValue::as_arc(&value);
     if let AnimationValue::Opacity(opacity) = **value {
@@ -827,33 +827,36 @@ pub extern "C" fn Servo_AnimationValue_G
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Opacity(opacity: f32) -> RawServoAnimationValueStrong {
     Arc::new(AnimationValue::Opacity(opacity)).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Color(
     color_property: nsCSSPropertyID,
-    color: structs::nscolor
+    color: structs::nscolor,
 ) -> RawServoAnimationValueStrong {
     use style::gecko::values::convert_nscolor_to_rgba;
     use style::values::animated::color::RGBA as AnimatedRGBA;
 
     let property = LonghandId::from_nscsspropertyid(color_property)
         .expect("We don't have shorthand property animation value");
 
     let rgba = convert_nscolor_to_rgba(color);
 
-    let animatedRGBA = AnimatedRGBA::new(rgba.red_f32(),
-                                         rgba.green_f32(),
-                                         rgba.blue_f32(),
-                                         rgba.alpha_f32());
+    let animatedRGBA = AnimatedRGBA::new(
+        rgba.red_f32(),
+        rgba.green_f32(),
+        rgba.blue_f32(),
+        rgba.alpha_f32(),
+    );
     match property {
-        LonghandId::BackgroundColor =>
-            Arc::new(AnimationValue::BackgroundColor(animatedRGBA.into())).into_strong(),
+        LonghandId::BackgroundColor => {
+            Arc::new(AnimationValue::BackgroundColor(animatedRGBA.into())).into_strong()
+        },
         _ => panic!("Should be background-color property"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_GetTransform(
     value: RawServoAnimationValueBorrowed,
     list: *mut structs::RefPtr<nsCSSValueSharedList>,
@@ -3567,22 +3570,17 @@ pub extern "C" fn Servo_StyleSet_Rebuild
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_Drop(data: RawServoStyleSetOwned) {
     let _ = data.into_box::<PerDocumentStyleData>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_CompatModeChanged(raw_data: RawServoStyleSetBorrowed) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let doc = &*data
-        .stylist
-        .device()
-        .pres_context()
-        .mDocument
-        .mRawPtr;
+    let doc = &*data.stylist.device().pres_context().mDocument.mRawPtr;
     data.stylist
         .set_quirks_mode(QuirksMode::from(doc.mCompatMode));
 }
 
 fn parse_property_into(
     declarations: &mut SourcePropertyDeclaration,
     property_id: PropertyId,
     value: *const nsACString,
@@ -4445,20 +4443,21 @@ pub extern "C" fn Servo_DeclarationBlock
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
 ) {
     use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing;
     use style::properties::{LonghandId, PropertyDeclaration};
+    use style::values::generics::length::MozLength;
     use style::values::generics::NonNegative;
-    use style::values::generics::length::MozLength;
-    use style::values::specified::length::{NoCalcLength, NonNegativeLength, NonNegativeLengthPercentage};
-    use style::values::specified::length::{LengthPercentageOrAuto, LengthPercentage};
+    use style::values::specified::length::NonNegativeLengthPercentage;
+    use style::values::specified::length::{LengthPercentage, LengthPercentageOrAuto};
+    use style::values::specified::length::{NoCalcLength, NonNegativeLength};
     use style::values::specified::{BorderCornerRadius, BorderSideWidth};
 
     let long = get_longhand_from_id!(property);
     let nocalc = NoCalcLength::from_px(value);
     let lp = LengthPercentage::Length(nocalc);
     let lp_or_auto = LengthPercentageOrAuto::LengthPercentage(lp.clone());
     let prop = match_wrap_declared! { long,
         Height => MozLength::LengthPercentageOrAuto(lp_or_auto),
@@ -4506,18 +4505,19 @@ pub extern "C" fn Servo_DeclarationBlock
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
     unit: structs::nsCSSUnit,
 ) {
     use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize;
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::length::MozLength;
+    use style::values::specified::length::NoCalcLength;
     use style::values::specified::length::{AbsoluteLength, FontRelativeLength};
-    use style::values::specified::length::{LengthPercentage, LengthPercentageOrAuto, NoCalcLength};
+    use style::values::specified::length::{LengthPercentage, LengthPercentageOrAuto};
 
     let long = get_longhand_from_id!(property);
     let nocalc = match unit {
         structs::nsCSSUnit::eCSSUnit_EM => {
             NoCalcLength::FontRelative(FontRelativeLength::Em(value))
         },
         structs::nsCSSUnit::eCSSUnit_XHeight => {
             NoCalcLength::FontRelative(FontRelativeLength::Ex(value))
@@ -4574,22 +4574,21 @@ pub extern "C" fn Servo_DeclarationBlock
 pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
 ) {
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::computed::Percentage;
     use style::values::generics::length::MozLength;
-    use style::values::specified::length::{LengthPercentageOrAuto, LengthPercentage};
+    use style::values::specified::length::{LengthPercentage, LengthPercentageOrAuto};
 
     let long = get_longhand_from_id!(property);
     let pc = Percentage(value);
-    let lp_or_auto =
-        LengthPercentageOrAuto::LengthPercentage(LengthPercentage::Percentage(pc));
+    let lp_or_auto = LengthPercentageOrAuto::LengthPercentage(LengthPercentage::Percentage(pc));
 
     let prop = match_wrap_declared! { long,
         Height => MozLength::LengthPercentageOrAuto(lp_or_auto),
         Width => MozLength::LengthPercentageOrAuto(lp_or_auto),
         MarginTop => lp_or_auto,
         MarginRight => lp_or_auto,
         MarginBottom => lp_or_auto,
         MarginLeft => lp_or_auto,
--- a/servo/ports/geckolib/stylesheet_loader.rs
+++ b/servo/ports/geckolib/stylesheet_loader.rs
@@ -2,25 +2,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 use cssparser::SourceLocation;
 use nsstring::nsCString;
 use servo_arc::Arc;
 use style::context::QuirksMode;
 use style::gecko::data::GeckoStyleSheet;
-use style::global_style_data::GLOBAL_STYLE_DATA;
 use style::gecko_bindings::bindings;
 use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
 use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
 use style::gecko_bindings::structs::{
     SheetLoadData, SheetLoadDataHolder, StyleSheet as DomStyleSheet,
 };
 use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasBoxFFI, OwnedOrNull};
 use style::gecko_bindings::sugar::refptr::RefPtr;
+use style::global_style_data::GLOBAL_STYLE_DATA;
 use style::media_queries::MediaList;
 use style::parser::ParserContext;
 use style::shared_lock::{Locked, SharedRwLock};
 use style::stylesheets::import_rule::ImportSheet;
 use style::stylesheets::{ImportRule, Origin, StylesheetLoader as StyleStylesheetLoader};
 use style::stylesheets::{StylesheetContents, UrlExtraData};
 use style::use_counters::UseCounters;
 use style::values::CssUrl;
--- a/servo/ports/geckolib/tests/specified_values.rs
+++ b/servo/ports/geckolib/tests/specified_values.rs
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 #[cfg(all(test, target_pointer_width = "64"))]
 #[test]
 fn size_of_specified_values() {
+    use std::mem::size_of;
     use style;
-    use std::mem::size_of;
 
     let threshold = 24;
 
     let mut bad_properties = vec![];
 
     macro_rules! check_property {
         ( $( { $name: ident, $boxed: expr } )+ ) => {
             $(