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

@ -70,11 +70,7 @@ impl Parse for SingleValue {
match *input.next()? {
Token::Number {
int_value: Some(v), ..
}
if v >= 0 =>
{
Ok(SingleValue(v as u32))
},
} if v >= 0 => Ok(SingleValue(v as u32)),
ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
@ -103,22 +99,14 @@ impl Parse for PairValues {
let first = match *input.next()? {
Token::Number {
int_value: Some(a), ..
}
if a >= 0 =>
{
a as u32
},
} if a >= 0 => a as u32,
ref t => return Err(location.new_unexpected_token_error(t.clone())),
};
let location = input.current_source_location();
match input.next() {
Ok(&Token::Number {
int_value: Some(b), ..
})
if b >= 0 =>
{
Ok(PairValues(first, Some(b as u32)))
},
}) if b >= 0 => Ok(PairValues(first, Some(b as u32))),
// It can't be anything other than number.
Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
// It can be just one value.
@ -157,11 +145,9 @@ impl Parse for VectorValues {
match input.next() {
Ok(&Token::Number {
int_value: Some(a), ..
})
if a >= 0 =>
{
}) if a >= 0 => {
vec.push(a as u32);
}
},
// It can't be anything other than number.
Ok(t) => return Err(location.new_unexpected_token_error(t.clone())),
Err(_) => break,

View file

@ -141,11 +141,7 @@ impl KeyframePercentage {
Token::Percentage {
unit_value: percentage,
..
}
if percentage >= 0. && percentage <= 1. =>
{
Ok(KeyframePercentage::new(percentage))
},
} if percentage >= 0. && percentage <= 1. => Ok(KeyframePercentage::new(percentage)),
_ => Err(input.new_unexpected_token_error(token)),
}
}
@ -600,7 +596,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for KeyframeDeclarationParser<'a, 'b> {
let id = match PropertyId::parse(&name, self.context) {
Ok(id) => id,
Err(()) => {
return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)))
return Err(input.new_custom_error(StyleParseErrorKind::UnknownProperty(name)));
},
};

View file

@ -107,9 +107,10 @@ impl<'b> TopLevelRuleParser<'b> {
// If there's anything that isn't a namespace rule (or import rule, but
// we checked that already at the beginning), reject with a
// StateError.
if new_state == State::Namespaces && ctx.rule_list[ctx.index..]
.iter()
.any(|r| !matches!(*r, CssRule::Namespace(..)))
if new_state == State::Namespaces &&
ctx.rule_list[ctx.index..]
.iter()
.any(|r| !matches!(*r, CssRule::Namespace(..)))
{
self.dom_error = Some(RulesMutateError::InvalidState);
return false;

View file

@ -145,7 +145,7 @@ impl SupportsCondition {
function: &str,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
match_ignore_ascii_case!{ function,
match_ignore_ascii_case! { function,
// Although this is an internal syntax, it is not necessary
// to check parsing context as far as we accept any
// unexpected token as future syntax, and evaluate it to
@ -350,9 +350,8 @@ impl RawSelector {
use crate::selector_parser::PseudoElement;
use selectors::parser::Component;
let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() && selector
.iter_raw_match_order()
.any(|component| {
let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() &&
selector.iter_raw_match_order().any(|component| {
matches!(
*component,
Component::PseudoElement(PseudoElement::UnknownWebkit(..))

View file

@ -7,7 +7,6 @@
//! [at]: https://drafts.csswg.org/css-device-adapt/#atviewport-rule
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
use app_units::Au;
use crate::context::QuirksMode;
use crate::error_reporting::ContextualParseError;
use crate::font_metrics::get_metrics_provider_for_product;
@ -20,6 +19,7 @@ use crate::str::CssStringWriter;
use crate::stylesheets::{Origin, StylesheetInDocument};
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
use app_units::Au;
use cssparser::CowRcStr;
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use euclid::TypedSize2D;