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

@ -11,8 +11,8 @@ use style_traits::{CssWriter, ParseError, ToCss};
/// A CSS value made of four components, where its `ToCss` impl will try to
/// serialize as few components as possible, like for example in `border-width`.
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
ToComputedValue)]
pub struct Rect<T>(pub T, pub T, pub T, pub T);
impl<T> Rect<T> {
@ -23,7 +23,8 @@ impl<T> Rect<T> {
}
impl<T> Rect<T>
where T: Clone
where
T: Clone,
{
/// Returns a rect with all the values equal to `v`.
pub fn all(v: T) -> Self {
@ -34,20 +35,32 @@ impl<T> Rect<T>
pub fn parse_with<'i, 't, Parse>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
parse: Parse)
-> Result<Self, ParseError<'i>>
where Parse: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>>
parse: Parse,
) -> Result<Self, ParseError<'i>>
where
Parse: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>>,
{
let first = parse(context, input)?;
let second = if let Ok(second) = input.try(|i| parse(context, i)) { second } else {
let second = if let Ok(second) = input.try(|i| parse(context, i)) {
second
} else {
// <first>
return Ok(Self::new(first.clone(), first.clone(), first.clone(), first));
return Ok(Self::new(
first.clone(),
first.clone(),
first.clone(),
first,
));
};
let third = if let Ok(third) = input.try(|i| parse(context, i)) { third } else {
let third = if let Ok(third) = input.try(|i| parse(context, i)) {
third
} else {
// <first> <second>
return Ok(Self::new(first.clone(), second.clone(), first, second));
};
let fourth = if let Ok(fourth) = input.try(|i| parse(context, i)) { fourth } else {
let fourth = if let Ok(fourth) = input.try(|i| parse(context, i)) {
fourth
} else {
// <first> <second> <third>
return Ok(Self::new(first, second.clone(), third, second));
};
@ -57,16 +70,21 @@ impl<T> Rect<T>
}
impl<T> Parse for Rect<T>
where T: Clone + Parse
where
T: Clone + Parse,
{
#[inline]
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Self::parse_with(context, input, T::parse)
}
}
impl<T> ToCss for Rect<T>
where T: PartialEq + ToCss
where
T: PartialEq + ToCss,
{
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where