Rustfmt has changed its default style :/

This commit is contained in:
Simon Sapin 2018-12-14 08:31:30 +01:00
parent 82fc6d9f49
commit be69f9c3e6
207 changed files with 1200 additions and 1339 deletions

View file

@ -193,7 +193,7 @@ impl Angle {
AllowUnitlessZeroAngle::No => Err(()),
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {
return input.parse_nested_block(|i| CalcNode::parse_angle(context, i))
return input.parse_nested_block(|i| CalcNode::parse_angle(context, i));
},
_ => Err(()),
}

View file

@ -218,10 +218,7 @@ impl Display {
// Special handling for contents and list-item on the root
// element for Gecko.
#[cfg(feature = "gecko")]
Display::Contents | Display::ListItem if _is_root_element =>
{
Display::Block
},
Display::Contents | Display::ListItem if _is_root_element => Display::Block,
// These are not changed by blockification.
Display::None | Display::Block | Display::Flex | Display::ListItem | Display::Table => {
@ -747,7 +744,9 @@ impl Parse for Contain {
let flag = match flag {
Some(flag) if !result.contains(flag) => flag,
_ => {
return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name)))
return Err(
input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name))
);
},
};
result.insert(flag);
@ -826,7 +825,7 @@ impl Parse for TransitionProperty {
location,
ident,
&["none"],
)?))
)?));
},
};
@ -1309,7 +1308,7 @@ impl BreakBetween {
Ok(v) => v,
Err(()) => {
return Err(location
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())));
},
};
match break_value {

View file

@ -180,7 +180,7 @@ impl CalcNode {
) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(CalcNode::Length)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError))
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
(
&Token::Dimension {
@ -204,7 +204,7 @@ impl CalcNode {
},
(&Token::Percentage { unit_value, .. }, CalcUnit::LengthOrPercentage) |
(&Token::Percentage { unit_value, .. }, CalcUnit::Percentage) => {
return Ok(CalcNode::Percentage(unit_value))
return Ok(CalcNode::Percentage(unit_value));
},
(&Token::ParenthesisBlock, _) => {},
(&Token::Function(ref name), _) if name.eq_ignore_ascii_case("calc") => {},

View file

@ -181,7 +181,7 @@ impl Parse for Content {
None => {
return Err(input.new_custom_error(
StyleParseErrorKind::UnexpectedFunction(name.clone()),
))
));
},
}
},

View file

@ -4,8 +4,6 @@
//! Specified values for font properties
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
#[cfg(feature = "gecko")]
use crate::gecko_bindings::bindings;
use crate::parser::{Parse, ParserContext};
@ -22,6 +20,8 @@ use crate::values::specified::{AllowQuirks, Angle, Integer, LengthOrPercentage};
use crate::values::specified::{NoCalcLength, Number, Percentage};
use crate::values::CustomIdent;
use crate::Atom;
use app_units::Au;
use byteorder::{BigEndian, ByteOrder};
use cssparser::{Parser, Token};
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};

View file

@ -22,11 +22,7 @@ pub fn parse_flex<'i, 't>(input: &mut Parser<'i, 't>) -> Result<CSSFloat, ParseE
match *input.next()? {
Token::Dimension {
value, ref unit, ..
}
if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() =>
{
Ok(value)
},
} if unit.eq_ignore_ascii_case("fr") && value.is_sign_positive() => Ok(value),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}

View file

@ -262,7 +262,7 @@ impl Parse for Gradient {
let (shape, repeating, mut compat_mode) = match result {
Some(result) => result,
None => {
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)))
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedFunction(func)));
},
};
@ -792,7 +792,7 @@ impl LineDirection {
CompatMode::WebKit if to_ident.is_ok() => {
return Err(
i.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("to".into()))
)
);
},
_ => {},
}

View file

@ -7,7 +7,6 @@
//! [length]: https://drafts.csswg.org/css-values/#lengths
use super::{AllowQuirks, Number, Percentage, ToComputedValue};
use app_units::Au;
use crate::font_metrics::FontMetricsQueryResult;
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, CSSPixelLength, Context, ExtremumLength};
@ -17,6 +16,7 @@ use crate::values::generics::transform::IsZeroLength;
use crate::values::generics::NonNegative;
use crate::values::specified::calc::CalcNode;
use crate::values::{Auto, CSSFloat, Either, IsAuto, Normal};
use app_units::Au;
use cssparser::{Parser, Token};
use euclid::Size2D;
use std::cmp;
@ -601,12 +601,10 @@ impl Length {
match *token {
Token::Dimension {
value, ref unit, ..
}
if num_context.is_ok(context.parsing_mode, value) =>
{
} if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(Length::NoCalc)
.map_err(|()| location.new_unexpected_token_error(token.clone()))
.map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
@ -790,20 +788,18 @@ impl LengthOrPercentage {
match *token {
Token::Dimension {
value, ref unit, ..
}
if num_context.is_ok(context.parsing_mode, value) =>
{
} if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentage::Length)
.map_err(|()| location.new_unexpected_token_error(token.clone()))
.map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentage::Percentage(computed::Percentage(
unit_value,
)))
},
)));
}
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@ -922,20 +918,18 @@ impl LengthOrPercentageOrAuto {
match *token {
Token::Dimension {
value, ref unit, ..
}
if num_context.is_ok(context.parsing_mode, value) =>
{
} if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrAuto::Length)
.map_err(|()| location.new_unexpected_token_error(token.clone()))
.map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrAuto::Percentage(computed::Percentage(
unit_value,
)))
},
)));
}
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@ -948,7 +942,7 @@ impl LengthOrPercentageOrAuto {
)));
},
Token::Ident(ref value) if value.eq_ignore_ascii_case("auto") => {
return Ok(LengthOrPercentageOrAuto::Auto)
return Ok(LengthOrPercentageOrAuto::Auto);
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
_ => return Err(location.new_unexpected_token_error(token.clone())),
@ -1088,20 +1082,18 @@ impl LengthOrPercentageOrNone {
match *token {
Token::Dimension {
value, ref unit, ..
}
if num_context.is_ok(context.parsing_mode, value) =>
{
} if num_context.is_ok(context.parsing_mode, value) => {
return NoCalcLength::parse_dimension(context, value, unit)
.map(LengthOrPercentageOrNone::Length)
.map_err(|()| location.new_unexpected_token_error(token.clone()))
.map_err(|()| location.new_unexpected_token_error(token.clone()));
},
Token::Percentage { unit_value, .. }
if num_context.is_ok(context.parsing_mode, unit_value) =>
{
return Ok(LengthOrPercentageOrNone::Percentage(computed::Percentage(
unit_value,
)))
},
)));
}
Token::Number { value, .. } if num_context.is_ok(context.parsing_mode, value) => {
if value != 0. &&
!context.parsing_mode.allows_unitless_lengths() &&
@ -1115,7 +1107,7 @@ impl LengthOrPercentageOrNone {
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
Token::Ident(ref value) if value.eq_ignore_ascii_case("none") => {
return Ok(LengthOrPercentageOrNone::None)
return Ok(LengthOrPercentageOrNone::None);
},
_ => return Err(location.new_unexpected_token_error(token.clone())),
}

View file

@ -138,7 +138,7 @@ fn parse_number_with_clamping_mode<'i, 't>(
return Ok(Number {
value: value.min(f32::MAX).max(f32::MIN),
calc_clamping_mode: None,
})
});
},
Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {},
ref t => return Err(location.new_unexpected_token_error(t.clone())),
@ -808,7 +808,7 @@ impl Attr {
Some(ns) => ns,
None => {
return Err(location
.new_custom_error(StyleParseErrorKind::UnspecifiedError))
.new_custom_error(StyleParseErrorKind::UnspecifiedError));
},
};
Some((prefix, ns))

View file

@ -4,13 +4,13 @@
//! https://html.spec.whatwg.org/multipage/#source-size-list
use app_units::Au;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
use app_units::Au;
use cssparser::{Delimiter, Parser, Token};
use selectors::context::QuirksMode;
use style_traits::ParseError;
@ -118,7 +118,7 @@ impl SourceSizeList {
return Self {
source_sizes,
value: Some(value),
}
};
},
Ok(SourceSizeOrLength::SourceSize(source_size)) => {
source_sizes.push(source_size);

View file

@ -91,8 +91,7 @@ impl Parse for LineHeight {
match ident {
ref ident if ident.eq_ignore_ascii_case("normal") => Ok(GenericLineHeight::Normal),
#[cfg(feature = "gecko")]
ref ident if ident.eq_ignore_ascii_case("-moz-block-height") =>
{
ref ident if ident.eq_ignore_ascii_case("-moz-block-height") => {
Ok(GenericLineHeight::MozBlockHeight)
},
ident => {

View file

@ -92,12 +92,10 @@ impl Time {
// ParsingMode::DEFAULT directly.
Ok(&Token::Dimension {
value, ref unit, ..
})
if clamping_mode.is_ok(ParsingMode::DEFAULT, value) =>
{
}) if clamping_mode.is_ok(ParsingMode::DEFAULT, value) => {
return Time::parse_dimension(value, unit, /* from_calc = */ false)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
},
Ok(&Token::Function(ref name)) if name.eq_ignore_ascii_case("calc") => {},
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(e) => return Err(e.into()),