Bug 1517511, bug 1518098 - followup: Rustfmt so Servo's lints are happy.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 07 Jan 2019 16:57:43 +0100
changeset 452714 5c8bcb1cf3e7c6f9bca3e8afb582ce81b8fed361
parent 452713 6b7071abf6eae6ec3c03f8f8bf5cc4f49cadfd5a
child 452715 10276b98cd16c4537cbd2f344354f2c38b5b7e04
push id35328
push userncsoregi@mozilla.com
push dateMon, 07 Jan 2019 21:46:20 +0000
treeherdermozilla-central@14d8f03b496c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1517511, 1518098
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 1517511, bug 1518098 - followup: Rustfmt so Servo's lints are happy.
servo/components/style/gecko/conversions.rs
servo/components/style/gecko/values.rs
servo/components/style/gecko_bindings/sugar/ns_css_value.rs
servo/components/style/stylesheets/viewport_rule.rs
servo/components/style/values/animated/length.rs
servo/components/style/values/animated/svg.rs
servo/components/style/values/computed/basic_shape.rs
servo/components/style/values/computed/image.rs
servo/components/style/values/computed/length.rs
servo/components/style/values/generics/transform.rs
servo/components/style/values/specified/box.rs
servo/components/style/values/specified/grid.rs
servo/components/style/values/specified/image.rs
servo/components/style/values/specified/length.rs
--- a/servo/components/style/gecko/conversions.rs
+++ b/servo/components/style/gecko/conversions.rs
@@ -75,28 +75,28 @@ impl From<nsStyleCoord_CalcValue> for Le
         LengthPercentageOrAuto::LengthPercentage(LengthPercentage::from(other))
     }
 }
 
 // FIXME(emilio): A lot of these impl From should probably become explicit or
 // disappear as we move more stuff to cbindgen.
 impl From<nsStyleCoord_CalcValue> for NonNegativeLengthPercentageOrAuto {
     fn from(other: nsStyleCoord_CalcValue) -> Self {
-        NonNegative(
-            LengthPercentageOrAuto::LengthPercentage(LengthPercentage::with_clamping_mode(
+        NonNegative(LengthPercentageOrAuto::LengthPercentage(
+            LengthPercentage::with_clamping_mode(
                 Au(other.mLength).into(),
                 if other.mHasPercent {
                     Some(Percentage(other.mPercent))
                 } else {
                     None
                 },
                 AllowedNumericType::NonNegative,
                 /* was_calc = */ true,
-            ))
-        )
+            ),
+        ))
     }
 }
 
 impl From<Angle> for CoordDataValue {
     fn from(reference: Angle) -> Self {
         CoordDataValue::Degree(reference.degrees())
     }
 }
@@ -524,27 +524,25 @@ impl nsStyleImage {
                             },
                             size => Circle::Extent(gecko_size_to_keyword(size)),
                         };
                         EndingShape::Circle(circle)
                     },
                     structs::NS_STYLE_GRADIENT_SHAPE_ELLIPTICAL => {
                         let length_percentage_keyword = match gecko_gradient.mSize as u32 {
                             structs::NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE => match (
-                                LengthPercentage::from_gecko_style_coord(
-                                    &gecko_gradient.mRadiusX,
-                                ),
-                                LengthPercentage::from_gecko_style_coord(
-                                    &gecko_gradient.mRadiusY,
-                                ),
+                                LengthPercentage::from_gecko_style_coord(&gecko_gradient.mRadiusX),
+                                LengthPercentage::from_gecko_style_coord(&gecko_gradient.mRadiusY),
                             ) {
                                 (Some(x), Some(y)) => Ellipse::Radii(x, y),
                                 _ => {
-                                    debug_assert!(false,
-                                                      "mRadiusX, mRadiusY could not convert to LengthPercentage");
+                                    debug_assert!(
+                                        false,
+                                        "mRadiusX, mRadiusY could not convert to LengthPercentage"
+                                    );
                                     Ellipse::Radii(
                                         LengthPercentage::zero(),
                                         LengthPercentage::zero(),
                                     )
                                 },
                             },
                             size => Ellipse::Extent(gecko_size_to_keyword(size)),
                         };
@@ -797,20 +795,19 @@ pub mod basic_shape {
             let get_corner = |index| {
                 BorderCornerRadius::new(
                     NonNegative(
                         LengthPercentage::from_gecko_style_coord(&other.data_at(index)).expect(
                             "<border-radius> should be a length, percentage, or calc value",
                         ),
                     ),
                     NonNegative(
-                        LengthPercentage::from_gecko_style_coord(&other.data_at(index + 1))
-                            .expect(
-                                "<border-radius> should be a length, percentage, or calc value",
-                            ),
+                        LengthPercentage::from_gecko_style_coord(&other.data_at(index + 1)).expect(
+                            "<border-radius> should be a length, percentage, or calc value",
+                        ),
                     ),
                 )
             };
 
             GenericBorderRadius {
                 top_left: get_corner(0),
                 top_right: get_corner(2),
                 bottom_right: get_corner(4),
--- a/servo/components/style/gecko/values.rs
+++ b/servo/components/style/gecko/values.rs
@@ -144,29 +144,31 @@ impl GeckoStyleCoordConvertible for Numb
             _ => None,
         }
     }
 }
 
 impl GeckoStyleCoordConvertible for LengthPercentage {
     fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
         if self.was_calc {
-            return coord.set_value(CoordDataValue::Calc((*self).into()))
+            return coord.set_value(CoordDataValue::Calc((*self).into()));
         }
         debug_assert!(self.percentage.is_none() || self.unclamped_length() == Length::zero());
         if let Some(p) = self.percentage {
             return coord.set_value(CoordDataValue::Percent(p.0));
         }
         coord.set_value(CoordDataValue::Coord(self.unclamped_length().to_i32_au()))
     }
 
     fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
         match coord.as_value() {
             CoordDataValue::Coord(coord) => Some(LengthPercentage::new(Au(coord).into(), None)),
-            CoordDataValue::Percent(p) => Some(LengthPercentage::new(Au(0).into(), Some(Percentage(p)))),
+            CoordDataValue::Percent(p) => {
+                Some(LengthPercentage::new(Au(0).into(), Some(Percentage(p))))
+            },
             CoordDataValue::Calc(calc) => Some(calc.into()),
             _ => None,
         }
     }
 }
 
 impl GeckoStyleCoordConvertible for Length {
     fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
@@ -187,33 +189,35 @@ impl GeckoStyleCoordConvertible for Leng
             LengthPercentageOrAuto::Auto => coord.set_value(CoordDataValue::Auto),
             LengthPercentageOrAuto::LengthPercentage(ref lp) => lp.to_gecko_style_coord(coord),
         }
     }
 
     fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
         match coord.as_value() {
             CoordDataValue::Auto => Some(LengthPercentageOrAuto::Auto),
-            _ => LengthPercentage::from_gecko_style_coord(coord).map(LengthPercentageOrAuto::LengthPercentage),
+            _ => LengthPercentage::from_gecko_style_coord(coord)
+                .map(LengthPercentageOrAuto::LengthPercentage),
         }
     }
 }
 
 impl GeckoStyleCoordConvertible for LengthPercentageOrNone {
     fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
         match *self {
             LengthPercentageOrNone::None => coord.set_value(CoordDataValue::None),
             LengthPercentageOrNone::LengthPercentage(ref lp) => lp.to_gecko_style_coord(coord),
         }
     }
 
     fn from_gecko_style_coord<T: CoordData>(coord: &T) -> Option<Self> {
         match coord.as_value() {
             CoordDataValue::None => Some(LengthPercentageOrNone::None),
-            _ => LengthPercentage::from_gecko_style_coord(coord).map(LengthPercentageOrNone::LengthPercentage),
+            _ => LengthPercentage::from_gecko_style_coord(coord)
+                .map(LengthPercentageOrNone::LengthPercentage),
         }
     }
 }
 
 impl<L: GeckoStyleCoordConvertible> GeckoStyleCoordConvertible for TrackBreadth<L> {
     fn to_gecko_style_coord<T: CoordDataMut>(&self, coord: &mut T) {
         match *self {
             TrackBreadth::Breadth(ref lp) => lp.to_gecko_style_coord(coord),
--- a/servo/components/style/gecko_bindings/sugar/ns_css_value.rs
+++ b/servo/components/style/gecko_bindings/sugar/ns_css_value.rs
@@ -65,17 +65,17 @@ impl nsCSSValue {
         let array = *self.mValue.mArray.as_ref();
         debug_assert!(!array.is_null());
         &*array
     }
 
     /// Sets LengthPercentage value to this nsCSSValue.
     pub unsafe fn set_length_percentage(&mut self, lp: LengthPercentage) {
         if lp.was_calc {
-            return bindings::Gecko_CSSValue_SetCalc(self, lp.into())
+            return bindings::Gecko_CSSValue_SetCalc(self, lp.into());
         }
         debug_assert!(lp.percentage.is_none() || lp.unclamped_length() == Length::zero());
         if let Some(p) = lp.percentage {
             return self.set_percentage(p.0);
         }
         self.set_px(lp.unclamped_length().px());
     }
 
@@ -88,27 +88,22 @@ impl nsCSSValue {
     pub unsafe fn set_percentage(&mut self, unit_value: f32) {
         bindings::Gecko_CSSValue_SetPercentage(self, unit_value)
     }
 
     /// Returns LengthPercentage value.
     pub unsafe fn get_length_percentage(&self) -> LengthPercentage {
         match self.mUnit {
             nsCSSUnit::eCSSUnit_Pixel => {
-                LengthPercentage::new(
-                    Length::new(bindings::Gecko_CSSValue_GetNumber(self)),
-                    None,
-                )
+                LengthPercentage::new(Length::new(bindings::Gecko_CSSValue_GetNumber(self)), None)
             },
             nsCSSUnit::eCSSUnit_Percent => LengthPercentage::new_percent(Percentage(
                 bindings::Gecko_CSSValue_GetPercentage(self),
             )),
-            nsCSSUnit::eCSSUnit_Calc => {
-                bindings::Gecko_CSSValue_GetCalc(self).into()
-            },
+            nsCSSUnit::eCSSUnit_Calc => bindings::Gecko_CSSValue_GetCalc(self).into(),
             _ => panic!("Unexpected unit"),
         }
     }
 
     /// Returns Length  value.
     pub unsafe fn get_length(&self) -> Length {
         match self.mUnit {
             nsCSSUnit::eCSSUnit_Pixel => Length::new(bindings::Gecko_CSSValue_GetNumber(self)),
--- a/servo/components/style/stylesheets/viewport_rule.rs
+++ b/servo/components/style/stylesheets/viewport_rule.rs
@@ -13,17 +13,19 @@ use crate::font_metrics::get_metrics_pro
 use crate::media_queries::Device;
 use crate::parser::ParserContext;
 use crate::properties::StyleBuilder;
 use crate::rule_cache::RuleCacheConditions;
 use crate::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
 use crate::str::CssStringWriter;
 use crate::stylesheets::{Origin, StylesheetInDocument};
 use crate::values::computed::{Context, ToComputedValue};
-use crate::values::specified::{self, LengthPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
+use crate::values::specified::{
+    self, LengthPercentageOrAuto, NoCalcLength, ViewportPercentageLength,
+};
 use app_units::Au;
 use cssparser::CowRcStr;
 use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
 use euclid::TypedSize2D;
 use selectors::parser::SelectorParseErrorKind;
 use std::borrow::Cow;
 use std::cell::RefCell;
 use std::fmt::{self, Write};
@@ -153,17 +155,17 @@ pub enum ViewportLength {
     ExtendToZoom,
 }
 
 impl FromMeta for ViewportLength {
     fn from_meta(value: &str) -> Option<ViewportLength> {
         macro_rules! specified {
             ($value:expr) => {
                 ViewportLength::Specified(LengthPercentageOrAuto::LengthPercentage(
-                    specified::LengthPercentage::Length($value)
+                    specified::LengthPercentage::Length($value),
                 ))
             };
         }
 
         Some(match value {
             v if v.eq_ignore_ascii_case("device-width") => specified!(
                 NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.))
             ),
@@ -750,19 +752,20 @@ impl MaybeNew for ViewportConstraints {
         }
 
         macro_rules! to_pixel_length {
             ($value:ident, $dimension:ident, $extend_to:ident => $auto_extend_to:expr) => {
                 if let Some($value) = $value {
                     match *$value {
                         ViewportLength::Specified(ref length) => match *length {
                             LengthPercentageOrAuto::Auto => None,
-                            LengthPercentageOrAuto::LengthPercentage(ref lop) => Some(lop
-                                .to_computed_value(&context)
-                                .to_used_value(initial_viewport.$dimension)),
+                            LengthPercentageOrAuto::LengthPercentage(ref lop) => Some(
+                                lop.to_computed_value(&context)
+                                    .to_used_value(initial_viewport.$dimension),
+                            ),
                         },
                         ViewportLength::ExtendToZoom => {
                             // $extend_to will be 'None' if 'extend-to-zoom' is 'auto'
                             match ($extend_to, $auto_extend_to) {
                                 (None, None) => None,
                                 (a, None) => a,
                                 (None, b) => b,
                                 (a, b) => cmp::max(a, b),
--- a/servo/components/style/values/animated/length.rs
+++ b/servo/components/style/values/animated/length.rs
@@ -22,17 +22,19 @@ impl Animate for LengthPercentage {
             let other = other.unwrap_or_default();
             Ok(Some(this.animate(&other, procedure)?))
         };
 
         let length = self
             .unclamped_length()
             .animate(&other.unclamped_length(), procedure)?;
         let percentage = animate_percentage_half(self.percentage, other.percentage)?;
-        let is_calc = self.was_calc || other.was_calc || self.percentage.is_some() != other.percentage.is_some();
+        let is_calc = self.was_calc ||
+            other.was_calc ||
+            self.percentage.is_some() != other.percentage.is_some();
         Ok(Self::with_clamping_mode(
             length,
             percentage,
             self.clamping_mode,
             is_calc,
         ))
     }
 }
--- a/servo/components/style/values/animated/svg.rs
+++ b/servo/components/style/values/animated/svg.rs
@@ -27,26 +27,24 @@ impl ToAnimatedZero for IntermediateSVGP
 }
 
 // FIXME: We need to handle calc here properly, see
 // https://bugzilla.mozilla.org/show_bug.cgi?id=1386967
 fn to_number_or_percentage(
     value: &SvgLengthPercentageOrNumber<LengthPercentage, Number>,
 ) -> Result<NumberOrPercentage, ()> {
     Ok(match *value {
-        SvgLengthPercentageOrNumber::LengthPercentage(ref l) => {
-            match l.percentage {
-                Some(p) => {
-                    if l.unclamped_length().px() != 0. {
-                        return Err(());
-                    }
-                    NumberOrPercentage::Percentage(p)
+        SvgLengthPercentageOrNumber::LengthPercentage(ref l) => match l.percentage {
+            Some(p) => {
+                if l.unclamped_length().px() != 0. {
+                    return Err(());
                 }
-                None => NumberOrPercentage::Number(l.length().px())
-            }
+                NumberOrPercentage::Percentage(p)
+            },
+            None => NumberOrPercentage::Number(l.length().px()),
         },
         SvgLengthPercentageOrNumber::Number(ref n) => NumberOrPercentage::Number(*n),
     })
 }
 
 impl Animate for SvgLengthPercentageOrNumber<LengthPercentage, Number> {
     #[inline]
     fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
--- a/servo/components/style/values/computed/basic_shape.rs
+++ b/servo/components/style/values/computed/basic_shape.rs
@@ -29,18 +29,17 @@ pub type BasicShape = generic::BasicShap
     LengthPercentage,
     NonNegativeLengthPercentage,
 >;
 
 /// The computed value of `inset()`
 pub type InsetRect = generic::InsetRect<LengthPercentage, NonNegativeLengthPercentage>;
 
 /// A computed circle.
-pub type Circle =
-    generic::Circle<LengthPercentage, LengthPercentage, NonNegativeLengthPercentage>;
+pub type Circle = generic::Circle<LengthPercentage, LengthPercentage, NonNegativeLengthPercentage>;
 
 /// A computed ellipse.
 pub type Ellipse =
     generic::Ellipse<LengthPercentage, LengthPercentage, NonNegativeLengthPercentage>;
 
 /// The computed value of `ShapeRadius`
 pub type ShapeRadius = generic::ShapeRadius<NonNegativeLengthPercentage>;
 
--- a/servo/components/style/values/computed/image.rs
+++ b/servo/components/style/values/computed/image.rs
@@ -66,20 +66,26 @@ pub type MozImageRect = generic::MozImag
 impl generic::LineDirection for LineDirection {
     fn points_downwards(&self, compat_mode: CompatMode) -> bool {
         match *self {
             LineDirection::Angle(angle) => angle.radians() == PI,
             LineDirection::Vertical(Y::Bottom) if compat_mode == CompatMode::Modern => true,
             LineDirection::Vertical(Y::Top) if compat_mode != CompatMode::Modern => true,
             LineDirection::Corner(..) => false,
             #[cfg(feature = "gecko")]
-            LineDirection::MozPosition(Some(Position { ref vertical, ref horizontal }), None) => {
+            LineDirection::MozPosition(
+                Some(Position {
+                    ref vertical,
+                    ref horizontal,
+                }),
+                None,
+            ) => {
                 // `50% 0%` is the default value for line direction.
                 horizontal.as_percentage().map_or(false, |p| p.0 == 0.5) &&
-                vertical.as_percentage().map_or(false, |p| p.0 == 0.0)
+                    vertical.as_percentage().map_or(false, |p| p.0 == 0.0)
             },
             _ => false,
         }
     }
 
     fn to_css<W>(&self, dest: &mut CssWriter<W>, compat_mode: CompatMode) -> fmt::Result
     where
         W: Write,
--- a/servo/components/style/values/computed/length.rs
+++ b/servo/components/style/values/computed/length.rs
@@ -1,16 +1,16 @@
 /* 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/. */
 
 //! `<length>` computed values, and related ones.
 
 use super::{Context, Number, Percentage, ToComputedValue};
-use crate::values::animated::{ToAnimatedValue};
+use crate::values::animated::ToAnimatedValue;
 use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
 use crate::values::generics::length::MaxLength as GenericMaxLength;
 use crate::values::generics::length::MozLength as GenericMozLength;
 use crate::values::generics::transform::IsZeroLength;
 use crate::values::generics::NonNegative;
 use crate::values::specified::length::ViewportPercentageLength;
 use crate::values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
 use crate::values::{specified, Auto, CSSFloat, Either, IsAuto, Normal};
@@ -165,17 +165,16 @@ impl LengthPercentage {
     }
 
     /// Returns the `<length>` component of this `calc()`, unclamped.
     #[inline]
     pub fn unclamped_length(&self) -> CSSPixelLength {
         self.length
     }
 
-
     /// Return the percentage value as CSSFloat.
     #[inline]
     pub fn percentage(&self) -> CSSFloat {
         self.percentage.map_or(0., |p| p.0)
     }
 
     /// Returns the percentage component if this could be represented as a
     /// non-calc percentage.
@@ -375,17 +374,17 @@ impl LengthPercentage {
     #[inline]
     pub fn clamp_to_non_negative(self) -> Self {
         if self.was_calc {
             return Self::with_clamping_mode(
                 self.length,
                 self.percentage,
                 AllowedNumericType::NonNegative,
                 self.was_calc,
-            )
+            );
         }
 
         debug_assert!(self.percentage.is_none() || self.unclamped_length() == Length::zero());
         if let Some(p) = self.percentage {
             return Self::with_clamping_mode(
                 Length::zero(),
                 Some(p.clamp_to_non_negative()),
                 AllowedNumericType::NonNegative,
@@ -405,55 +404,50 @@ impl LengthPercentage {
 impl ToComputedValue for specified::LengthPercentage {
     type ComputedValue = LengthPercentage;
 
     fn to_computed_value(&self, context: &Context) -> LengthPercentage {
         match *self {
             specified::LengthPercentage::Length(ref value) => {
                 LengthPercentage::new(value.to_computed_value(context), None)
             },
-            specified::LengthPercentage::Percentage(value) => {
-                LengthPercentage::new_percent(value)
-            },
-            specified::LengthPercentage::Calc(ref calc) => {
-                (**calc).to_computed_value(context)
-            },
+            specified::LengthPercentage::Percentage(value) => LengthPercentage::new_percent(value),
+            specified::LengthPercentage::Calc(ref calc) => (**calc).to_computed_value(context),
         }
     }
 
     fn from_computed_value(computed: &LengthPercentage) -> Self {
         let length = computed.unclamped_length();
         if let Some(p) = computed.as_percentage() {
-            return specified::LengthPercentage::Percentage(p)
+            return specified::LengthPercentage::Percentage(p);
         }
 
         let percentage = computed.percentage;
-        if percentage.is_none() &&
-            computed.clamping_mode.clamp(length.px()) == length.px() {
-            return specified::LengthPercentage::Length(
-                ToComputedValue::from_computed_value(&length)
-            )
+        if percentage.is_none() && computed.clamping_mode.clamp(length.px()) == length.px() {
+            return specified::LengthPercentage::Length(ToComputedValue::from_computed_value(
+                &length,
+            ));
         }
 
-        specified::LengthPercentage::Calc(Box::new(
-            ToComputedValue::from_computed_value(computed),
-        ))
+        specified::LengthPercentage::Calc(Box::new(ToComputedValue::from_computed_value(computed)))
     }
 }
 
 impl IsZeroLength for LengthPercentage {
     #[inline]
     fn is_zero_length(&self) -> bool {
         self.is_definitely_zero()
     }
 }
 
 #[allow(missing_docs)]
 #[css(derive_debug)]
-#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToAnimatedZero, ToCss)]
+#[derive(
+    Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToAnimatedZero, ToCss,
+)]
 pub enum LengthPercentageOrAuto {
     LengthPercentage(LengthPercentage),
     Auto,
 }
 
 impl LengthPercentageOrAuto {
     /// Returns the `0` value.
     #[inline]
@@ -517,19 +511,17 @@ impl LengthPercentageOrAuto {
 
 impl ToComputedValue for specified::LengthPercentageOrAuto {
     type ComputedValue = LengthPercentageOrAuto;
 
     #[inline]
     fn to_computed_value(&self, context: &Context) -> LengthPercentageOrAuto {
         match *self {
             specified::LengthPercentageOrAuto::LengthPercentage(ref value) => {
-                LengthPercentageOrAuto::LengthPercentage(
-                    value.to_computed_value(context),
-                )
+                LengthPercentageOrAuto::LengthPercentage(value.to_computed_value(context))
             },
             specified::LengthPercentageOrAuto::Auto => LengthPercentageOrAuto::Auto,
         }
     }
 
     #[inline]
     fn from_computed_value(computed: &LengthPercentageOrAuto) -> Self {
         match *computed {
@@ -540,17 +532,19 @@ impl ToComputedValue for specified::Leng
                 )
             },
         }
     }
 }
 
 #[allow(missing_docs)]
 #[css(derive_debug)]
-#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToAnimatedZero, ToCss)]
+#[derive(
+    Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToAnimatedZero, ToCss,
+)]
 pub enum LengthPercentageOrNone {
     LengthPercentage(LengthPercentage),
     None,
 }
 
 impl LengthPercentageOrNone {
     /// Returns the used value.
     pub fn to_used_value(&self, containing_length: Au) -> Option<Au> {
--- a/servo/components/style/values/generics/transform.rs
+++ b/servo/components/style/values/generics/transform.rs
@@ -186,27 +186,25 @@ pub enum TransformOperation<Angle, Numbe
     ///
     /// The value must be greater than or equal to zero.
     #[css(function)]
     Perspective(Length),
     /// A intermediate type for interpolation of mismatched transform lists.
     #[allow(missing_docs)]
     #[css(comma, function = "interpolatematrix")]
     InterpolateMatrix {
-        from_list:
-            Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
+        from_list: Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
         to_list: Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
         progress: computed::Percentage,
     },
     /// A intermediate type for accumulation of mismatched transform lists.
     #[allow(missing_docs)]
     #[css(comma, function = "accumulatematrix")]
     AccumulateMatrix {
-        from_list:
-            Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
+        from_list: Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
         to_list: Transform<TransformOperation<Angle, Number, Length, Integer, LengthPercentage>>,
         count: Integer,
     },
 }
 
 #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
 /// A value of the `transform` property
 pub struct Transform<T>(#[css(if_empty = "none", iterable)] pub Vec<T>);
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -273,18 +273,17 @@ impl Display {
 /// A specified value for the `vertical-align` property.
 pub type VerticalAlign = GenericVerticalAlign<LengthPercentage>;
 
 impl Parse for VerticalAlign {
     fn parse<'i, 't>(
         context: &ParserContext,
         input: &mut Parser<'i, 't>,
     ) -> Result<Self, ParseError<'i>> {
-        if let Ok(lp) =
-            input.try(|i| LengthPercentage::parse_quirky(context, i, AllowQuirks::Yes))
+        if let Ok(lp) = input.try(|i| LengthPercentage::parse_quirky(context, i, AllowQuirks::Yes))
         {
             return Ok(GenericVerticalAlign::Length(lp));
         }
 
         try_match_ident_ignore_ascii_case! { input,
             "baseline" => Ok(GenericVerticalAlign::Baseline),
             "sub" => Ok(GenericVerticalAlign::Sub),
             "super" => Ok(GenericVerticalAlign::Super),
--- a/servo/components/style/values/specified/grid.rs
+++ b/servo/components/style/values/specified/grid.rs
@@ -68,18 +68,17 @@ impl Parse for TrackSize<LengthPercentag
                 Ok(TrackSize::Minmax(
                     inflexible_breadth,
                     TrackBreadth::parse(context, input)?,
                 ))
             });
         }
 
         input.expect_function_matching("fit-content")?;
-        let lp =
-            input.parse_nested_block(|i| LengthPercentage::parse_non_negative(context, i))?;
+        let lp = input.parse_nested_block(|i| LengthPercentage::parse_non_negative(context, i))?;
         Ok(TrackSize::FitContent(lp))
     }
 }
 
 /// Parse the grid line names into a vector of owned strings.
 ///
 /// <https://drafts.csswg.org/css-grid/#typedef-line-names>
 pub fn parse_line_names<'i, 't>(
--- a/servo/components/style/values/specified/image.rs
+++ b/servo/components/style/values/specified/image.rs
@@ -693,26 +693,26 @@ impl generic::LineDirection for LineDire
             ) => {
                 use crate::values::computed::Percentage as ComputedPercentage;
                 use crate::values::specified::transform::OriginComponent;
 
                 // `50% 0%` is the default value for line direction.
                 // These percentage values can also be keywords.
                 let x = match *x {
                     OriginComponent::Center => true,
-                    OriginComponent::Length(LengthPercentage::Percentage(
-                        ComputedPercentage(val),
-                    )) => val == 0.5,
+                    OriginComponent::Length(LengthPercentage::Percentage(ComputedPercentage(
+                        val,
+                    ))) => val == 0.5,
                     _ => false,
                 };
                 let y = match *y {
                     OriginComponent::Side(Y::Top) => true,
-                    OriginComponent::Length(LengthPercentage::Percentage(
-                        ComputedPercentage(val),
-                    )) => val == 0.0,
+                    OriginComponent::Length(LengthPercentage::Percentage(ComputedPercentage(
+                        val,
+                    ))) => val == 0.0,
                     _ => false,
                 };
                 x && y
             },
             _ => false,
         }
     }
 
--- a/servo/components/style/values/specified/length.rs
+++ b/servo/components/style/values/specified/length.rs
@@ -917,22 +917,19 @@ impl LengthPercentageOrAuto {
         input: &mut Parser<'i, 't>,
         num_context: AllowedNumericType,
         allow_quirks: AllowQuirks,
     ) -> Result<Self, ParseError<'i>> {
         if input.try(|i| i.expect_ident_matching("auto")).is_ok() {
             return Ok(LengthPercentageOrAuto::Auto);
         }
 
-        Ok(LengthPercentageOrAuto::LengthPercentage(LengthPercentage::parse_internal(
-            context,
-            input,
-            num_context,
-            allow_quirks,
-        )?))
+        Ok(LengthPercentageOrAuto::LengthPercentage(
+            LengthPercentage::parse_internal(context, input, num_context, allow_quirks)?,
+        ))
     }
 
     /// Parse a non-negative length, percentage, or auto.
     #[inline]
     pub fn parse_non_negative<'i, 't>(
         context: &ParserContext,
         input: &mut Parser<'i, 't>,
     ) -> Result<LengthPercentageOrAuto, ParseError<'i>> {
@@ -1047,22 +1044,19 @@ impl LengthPercentageOrNone {
         input: &mut Parser<'i, 't>,
         num_context: AllowedNumericType,
         allow_quirks: AllowQuirks,
     ) -> Result<Self, ParseError<'i>> {
         if input.try(|i| i.expect_ident_matching("none")).is_ok() {
             return Ok(LengthPercentageOrNone::None);
         }
 
-        Ok(LengthPercentageOrNone::LengthPercentage(LengthPercentage::parse_internal(
-            context,
-            input,
-            num_context,
-            allow_quirks,
-        )?))
+        Ok(LengthPercentageOrNone::LengthPercentage(
+            LengthPercentage::parse_internal(context, input, num_context, allow_quirks)?,
+        ))
     }
 
     /// Parse a non-negative LengthPercentageOrNone.
     #[inline]
     pub fn parse_non_negative<'i, 't>(
         context: &ParserContext,
         input: &mut Parser<'i, 't>,
     ) -> Result<Self, ParseError<'i>> {
@@ -1112,18 +1106,17 @@ impl From<NoCalcLength> for NonNegativeL
 }
 
 impl Parse for NonNegativeLengthPercentage {
     #[inline]
     fn parse<'i, 't>(
         context: &ParserContext,
         input: &mut Parser<'i, 't>,
     ) -> Result<Self, ParseError<'i>> {
-        LengthPercentage::parse_non_negative(context, input)
-            .map(NonNegative::<LengthPercentage>)
+        LengthPercentage::parse_non_negative(context, input).map(NonNegative::<LengthPercentage>)
     }
 }
 
 impl NonNegativeLengthPercentage {
     #[inline]
     /// Returns a `zero` length.
     pub fn zero() -> Self {
         NonNegative::<LengthPercentage>(LengthPercentage::zero())