servo: Merge #20481 - style: Derive a debug impl instead of implementing by hand (from emilio:debug-wat); r=nox
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 02 Apr 2018 12:09:29 -0400
changeset 411363 60e7fca839b4767cb04dd500a0d4229447213248
parent 411362 bacd19ec0d4b81a51049faa28faddc2e4a35b3c2
child 411364 e3b6cc3709cdb77bf36666bcf0a28c0d1c8ab849
push id101635
push userdluca@mozilla.com
push dateMon, 02 Apr 2018 22:16:27 +0000
treeherdermozilla-inbound@2a199de2ee43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnox
milestone61.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
servo: Merge #20481 - style: Derive a debug impl instead of implementing by hand (from emilio:debug-wat); r=nox Source-Repo: https://github.com/servo/servo Source-Revision: 39018f933997e266e11968d82f556af15c5321d8
servo/components/style/values/generics/image.rs
--- a/servo/components/style/values/generics/image.rs
+++ b/servo/components/style/values/generics/image.rs
@@ -115,17 +115,17 @@ pub enum GradientItem<Color, LengthOrPer
     /// A color stop.
     ColorStop(ColorStop<Color, LengthOrPercentage>),
     /// An interpolation hint.
     InterpolationHint(LengthOrPercentage),
 }
 
 /// A color stop.
 /// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
-#[derive(Clone, Copy, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
+#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
 pub struct ColorStop<Color, LengthOrPercentage> {
     /// The color of this stop.
     pub color: Color,
     /// The position of this stop.
     pub position: Option<LengthOrPercentage>,
 }
 
 /// Specified values for a paint worklet.
@@ -305,20 +305,8 @@ where
                 keyword.to_css(dest)
             },
             Circle::Radius(ref length) => {
                 length.to_css(dest)
             },
         }
     }
 }
-
-impl<C, L> fmt::Debug for ColorStop<C, L>
-    where C: fmt::Debug, L: fmt::Debug,
-{
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{:?}", self.color)?;
-        if let Some(ref pos) = self.position {
-            write!(f, " {:?}", pos)?;
-        }
-        Ok(())
-    }
-}