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)
This commit is contained in:
Bobby Holley 2018-04-10 17:35:15 -07:00
parent f7ae1a37e3
commit c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions

View file

@ -32,8 +32,7 @@ pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, I
/// https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
#[derive(ToComputedValue, ToCss)]
#[derive(Animate, Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
pub enum ShapeBox {
MarginBox,
BorderBox,
@ -48,10 +47,7 @@ pub enum ShapeBox {
pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
#[animation(error)]
ImageOrUrl(ImageOrUrl),
Shape(
BasicShape,
Option<ReferenceBox>,
),
Shape(BasicShape, Option<ReferenceBox>),
#[animation(error)]
Box(ReferenceBox),
#[animation(error)]
@ -59,8 +55,8 @@ pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
}
#[allow(missing_docs)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToComputedValue, ToCss)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, ToComputedValue,
ToCss)]
pub enum BasicShape<H, V, LengthOrPercentage> {
Inset(#[css(field_bound)] InsetRect<LengthOrPercentage>),
Circle(#[css(field_bound)] Circle<H, V, LengthOrPercentage>),
@ -78,7 +74,8 @@ pub struct InsetRect<LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
#[allow(missing_docs)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
ToComputedValue)]
pub struct Circle<H, V, LengthOrPercentage> {
pub position: Position<H, V>,
pub radius: ShapeRadius<LengthOrPercentage>,
@ -86,7 +83,8 @@ pub struct Circle<H, V, LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
#[allow(missing_docs)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
ToComputedValue)]
pub struct Ellipse<H, V, LengthOrPercentage> {
pub position: Position<H, V>,
pub semiaxis_x: ShapeRadius<LengthOrPercentage>,
@ -95,8 +93,8 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius>
#[allow(missing_docs)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq)]
#[derive(ToComputedValue, ToCss)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
ToComputedValue, ToCss)]
pub enum ShapeRadius<LengthOrPercentage> {
Length(LengthOrPercentage),
#[animation(error)]
@ -122,8 +120,7 @@ pub struct Polygon<LengthOrPercentage> {
// says that it can also be `inherit`
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq)]
#[derive(ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
pub enum FillRule {
Nonzero,
Evenodd,
@ -141,7 +138,8 @@ where
(
&ShapeSource::Shape(ref this, ref this_box),
&ShapeSource::Shape(ref other, ref other_box),
) if this_box == other_box => {
) if this_box == other_box =>
{
this.compute_squared_distance(other)
},
_ => Err(()),
@ -156,7 +154,8 @@ impl<B, T, U> ToAnimatedZero for ShapeSource<B, T, U> {
}
impl<L> ToCss for InsetRect<L>
where L: ToCss + PartialEq
where
L: ToCss + PartialEq,
{
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
@ -174,7 +173,9 @@ impl<L> ToCss for InsetRect<L>
impl<L> Default for ShapeRadius<L> {
#[inline]
fn default() -> Self { ShapeRadius::ClosestSide }
fn default() -> Self {
ShapeRadius::ClosestSide
}
}
impl<L> Animate for Polygon<L>
@ -188,13 +189,20 @@ where
if self.coordinates.len() != other.coordinates.len() {
return Err(());
}
let coordinates = self.coordinates.iter().zip(other.coordinates.iter()).map(|(this, other)| {
Ok((
this.0.animate(&other.0, procedure)?,
this.1.animate(&other.1, procedure)?,
))
}).collect::<Result<Vec<_>, _>>()?;
Ok(Polygon { fill: self.fill, coordinates })
let coordinates = self.coordinates
.iter()
.zip(other.coordinates.iter())
.map(|(this, other)| {
Ok((
this.0.animate(&other.0, procedure)?,
this.1.animate(&other.1, procedure)?,
))
})
.collect::<Result<Vec<_>, _>>()?;
Ok(Polygon {
fill: self.fill,
coordinates,
})
}
}
@ -209,11 +217,15 @@ where
if self.coordinates.len() != other.coordinates.len() {
return Err(());
}
self.coordinates.iter().zip(other.coordinates.iter()).map(|(this, other)| {
let d1 = this.0.compute_squared_distance(&other.0)?;
let d2 = this.1.compute_squared_distance(&other.1)?;
Ok(d1 + d2)
}).sum()
self.coordinates
.iter()
.zip(other.coordinates.iter())
.map(|(this, other)| {
let d1 = this.0.compute_squared_distance(&other.0)?;
let d2 = this.1.compute_squared_distance(&other.1)?;
Ok(d1 + d2)
})
.sum()
}
}
@ -244,5 +256,7 @@ impl<L: ToCss> ToCss for Polygon<L> {
impl Default for FillRule {
#[inline]
fn default() -> Self { FillRule::Nonzero }
fn default() -> Self {
FillRule::Nonzero
}
}