This commit is contained in:
Simon Sapin 2019-02-26 08:18:33 +01:00
parent 7bb7c9a1e3
commit 4464354e2e
10 changed files with 42 additions and 21 deletions

View file

@ -180,7 +180,9 @@ 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 {
@ -190,7 +192,9 @@ impl CalcNode {
) => {
return Angle::parse_dimension(value, unit, /* from_calc = */ true)
.map(CalcNode::Angle)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
.map_err(|()| {
location.new_custom_error(StyleParseErrorKind::UnspecifiedError)
});
},
(
&Token::Dimension {
@ -200,7 +204,9 @@ impl CalcNode {
) => {
return Time::parse_dimension(value, unit, /* from_calc = */ true)
.map(CalcNode::Time)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
.map_err(|()| {
location.new_custom_error(StyleParseErrorKind::UnspecifiedError)
});
},
(&Token::Percentage { unit_value, .. }, CalcUnit::LengthPercentage) |
(&Token::Percentage { unit_value, .. }, CalcUnit::Percentage) => {

View file

@ -274,8 +274,9 @@ impl Color {
if ident.len() != 3 && ident.len() != 6 {
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
return parse_hash_color(ident.as_bytes())
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
return parse_hash_color(ident.as_bytes()).map_err(|()| {
location.new_custom_error(StyleParseErrorKind::UnspecifiedError)
});
},
ref t => {
return Err(location.new_unexpected_token_error(t.clone()));

View file

@ -614,7 +614,9 @@ impl Length {
!context.parsing_mode.allows_unitless_lengths() &&
!allow_quirks.allowed(context.quirks_mode)
{
return Err(location.new_custom_error(StyleParseErrorKind::UnspecifiedError));
return Err(
location.new_custom_error(StyleParseErrorKind::UnspecifiedError)
);
}
return Ok(Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(
value,

View file

@ -93,8 +93,9 @@ impl Time {
Ok(&Token::Dimension {
value, ref unit, ..
}) 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));
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())),