Reformat a couple match expressions

This commit is contained in:
Simon Sapin 2017-09-02 09:58:03 +02:00
parent ad4fe43187
commit f6d20e6461

View file

@ -90,60 +90,81 @@ impl<'a> ContextualParseError<'a> {
fn parse_error_to_str(err: &ParseError) -> String { fn parse_error_to_str(err: &ParseError) -> String {
match *err { match *err {
CssParseError::Basic(BasicParseError::UnexpectedToken(ref t)) => CssParseError::Basic(BasicParseError::UnexpectedToken(ref t)) => {
format!("found unexpected {}", token_to_str(t)), format!("found unexpected {}", token_to_str(t))
CssParseError::Basic(BasicParseError::EndOfInput) => }
format!("unexpected end of input"), CssParseError::Basic(BasicParseError::EndOfInput) => {
CssParseError::Basic(BasicParseError::AtRuleInvalid(ref i)) => format!("unexpected end of input")
format!("@ rule invalid: {}", i), }
CssParseError::Basic(BasicParseError::AtRuleBodyInvalid) => CssParseError::Basic(BasicParseError::AtRuleInvalid(ref i)) => {
format!("@ rule invalid"), format!("@ rule invalid: {}", i)
CssParseError::Basic(BasicParseError::QualifiedRuleInvalid) => }
format!("qualified rule invalid"), CssParseError::Basic(BasicParseError::AtRuleBodyInvalid) => {
CssParseError::Custom(ref err) => format!("@ rule invalid")
}
CssParseError::Basic(BasicParseError::QualifiedRuleInvalid) => {
format!("qualified rule invalid")
}
CssParseError::Custom(ref err) => {
format!("{:?}", err) format!("{:?}", err)
}
} }
} }
match *self { match *self {
ContextualParseError::UnsupportedPropertyDeclaration(decl, ref err) => ContextualParseError::UnsupportedPropertyDeclaration(decl, ref err) => {
format!("Unsupported property declaration: '{}', {}", decl, format!("Unsupported property declaration: '{}', {}", decl,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::UnsupportedFontFaceDescriptor(decl, ref err) => }
ContextualParseError::UnsupportedFontFaceDescriptor(decl, ref err) => {
format!("Unsupported @font-face descriptor declaration: '{}', {}", decl, format!("Unsupported @font-face descriptor declaration: '{}', {}", decl,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::UnsupportedFontFeatureValuesDescriptor(decl, ref err) => }
format!("Unsupported @font-feature-values descriptor declaration: '{}', {}", decl, ContextualParseError::UnsupportedFontFeatureValuesDescriptor(decl, ref err) => {
parse_error_to_str(err)), format!("Unsupported @font-feature-values descriptor declaration: '{}', {}", decl,
ContextualParseError::InvalidKeyframeRule(rule, ref err) => parse_error_to_str(err))
}
ContextualParseError::InvalidKeyframeRule(rule, ref err) => {
format!("Invalid keyframe rule: '{}', {}", rule, format!("Invalid keyframe rule: '{}', {}", rule,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::InvalidFontFeatureValuesRule(rule, ref err) => }
format!("Invalid font feature value rule: '{}', {}", rule, ContextualParseError::InvalidFontFeatureValuesRule(rule, ref err) => {
parse_error_to_str(err)), format!("Invalid font feature value rule: '{}', {}", rule,
ContextualParseError::UnsupportedKeyframePropertyDeclaration(decl, ref err) => parse_error_to_str(err))
}
ContextualParseError::UnsupportedKeyframePropertyDeclaration(decl, ref err) => {
format!("Unsupported keyframe property declaration: '{}', {}", decl, format!("Unsupported keyframe property declaration: '{}', {}", decl,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::InvalidRule(rule, ref err) => }
format!("Invalid rule: '{}', {}", rule, parse_error_to_str(err)), ContextualParseError::InvalidRule(rule, ref err) => {
ContextualParseError::UnsupportedRule(rule, ref err) => format!("Invalid rule: '{}', {}", rule, parse_error_to_str(err))
format!("Unsupported rule: '{}', {}", rule, parse_error_to_str(err)), }
ContextualParseError::UnsupportedViewportDescriptorDeclaration(decl, ref err) => ContextualParseError::UnsupportedRule(rule, ref err) => {
format!("Unsupported rule: '{}', {}", rule, parse_error_to_str(err))
}
ContextualParseError::UnsupportedViewportDescriptorDeclaration(decl, ref err) => {
format!("Unsupported @viewport descriptor declaration: '{}', {}", decl, format!("Unsupported @viewport descriptor declaration: '{}', {}", decl,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(decl, ref err) => }
ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(decl, ref err) => {
format!("Unsupported @counter-style descriptor declaration: '{}', {}", decl, format!("Unsupported @counter-style descriptor declaration: '{}', {}", decl,
parse_error_to_str(err)), parse_error_to_str(err))
ContextualParseError::InvalidCounterStyleWithoutSymbols(ref system) => }
format!("Invalid @counter-style rule: 'system: {}' without 'symbols'", system), ContextualParseError::InvalidCounterStyleWithoutSymbols(ref system) => {
ContextualParseError::InvalidCounterStyleNotEnoughSymbols(ref system) => format!("Invalid @counter-style rule: 'system: {}' without 'symbols'", system)
format!("Invalid @counter-style rule: 'system: {}' less than two 'symbols'", system), }
ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols => ContextualParseError::InvalidCounterStyleNotEnoughSymbols(ref system) => {
"Invalid @counter-style rule: 'system: additive' without 'additive-symbols'".into(), format!("Invalid @counter-style rule: 'system: {}' less than two 'symbols'", system)
ContextualParseError::InvalidCounterStyleExtendsWithSymbols => }
"Invalid @counter-style rule: 'system: extends …' with 'symbols'".into(), ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols => {
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => "Invalid @counter-style rule: 'system: additive' without 'additive-symbols'".into()
"Invalid @counter-style rule: 'system: extends …' with 'additive-symbols'".into(), }
ContextualParseError::InvalidCounterStyleExtendsWithSymbols => {
"Invalid @counter-style rule: 'system: extends …' with 'symbols'".into()
}
ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => {
"Invalid @counter-style rule: 'system: extends …' with 'additive-symbols'".into()
}
} }
} }
} }