Reformat a match expression

This commit is contained in:
Simon Sapin 2017-09-02 09:25:17 +02:00
parent 32b04b3f51
commit 3831a0a4e0

View file

@ -200,30 +200,42 @@ trait ErrorHelpers<'a> {
fn extract_error_param<'a>(err: ParseError<'a>) -> Option<ErrorString<'a>> { fn extract_error_param<'a>(err: ParseError<'a>) -> Option<ErrorString<'a>> {
Some(match err { Some(match err {
CssParseError::Basic(BasicParseError::UnexpectedToken(t)) => CssParseError::Basic(BasicParseError::UnexpectedToken(t)) => {
ErrorString::UnexpectedToken(t), ErrorString::UnexpectedToken(t)
}
CssParseError::Basic(BasicParseError::AtRuleInvalid(i)) | CssParseError::Basic(BasicParseError::AtRuleInvalid(i)) |
CssParseError::Custom(SelectorParseError::Custom( CssParseError::Custom(SelectorParseError::Custom(
StyleParseError::UnsupportedAtRule(i))) => StyleParseError::UnsupportedAtRule(i)
ErrorString::Snippet(format!("@{}", escape_css_ident(&i)).into()), )) => {
ErrorString::Snippet(format!("@{}", escape_css_ident(&i)).into())
}
CssParseError::Custom(SelectorParseError::Custom( CssParseError::Custom(SelectorParseError::Custom(
StyleParseError::PropertyDeclaration( StyleParseError::PropertyDeclaration(
PropertyDeclarationParseError::InvalidValue(property, None)))) => PropertyDeclarationParseError::InvalidValue(property, None)
ErrorString::Snippet(property), )
)) => {
ErrorString::Snippet(property)
}
CssParseError::Custom(SelectorParseError::UnexpectedIdent(ident)) => CssParseError::Custom(SelectorParseError::UnexpectedIdent(ident)) => {
ErrorString::Ident(ident), ErrorString::Ident(ident)
}
CssParseError::Custom(SelectorParseError::Custom( CssParseError::Custom(SelectorParseError::Custom(
StyleParseError::PropertyDeclaration( StyleParseError::PropertyDeclaration(
PropertyDeclarationParseError::UnknownProperty(property)))) => PropertyDeclarationParseError::UnknownProperty(property)
ErrorString::Ident(property), )
)) => {
ErrorString::Ident(property)
}
CssParseError::Custom(SelectorParseError::Custom( CssParseError::Custom(SelectorParseError::Custom(
StyleParseError::UnexpectedTokenWithinNamespace(token))) => StyleParseError::UnexpectedTokenWithinNamespace(token)
ErrorString::UnexpectedToken(token), )) => {
ErrorString::UnexpectedToken(token)
}
_ => return None, _ => return None,
}) })