From 9ace0e43ce60d7540c66cdd8619b24ef627759cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 4 Mar 2018 01:04:35 +0100 Subject: [PATCH] style: Cleanup indentation in a couple places. --- components/style/values/specified/svg.rs | 34 +++++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/components/style/values/specified/svg.rs b/components/style/values/specified/svg.rs index bca46ef2a88..80ff1c2125f 100644 --- a/components/style/values/specified/svg.rs +++ b/components/style/values/specified/svg.rs @@ -35,14 +35,16 @@ fn is_context_value_enabled() -> bool { false } -fn parse_context_value<'i, 't, T>(input: &mut Parser<'i, 't>, value: T) - -> Result> { - if is_context_value_enabled() { - if input.expect_ident_matching("context-value").is_ok() { - return Ok(value); - } +fn parse_context_value<'i, 't, T>( + input: &mut Parser<'i, 't>, + value: T, +) -> Result> { + if !is_context_value_enabled() { + return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } - Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)) + + input.expect_ident_matching("context-value")?; + Ok(value) } /// A value of | | for stroke-dashoffset. @@ -54,8 +56,10 @@ pub type SvgLengthOrPercentageOrNumber = pub type SVGLength = generic::SVGLength; impl Parse for SVGLength { - fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) - -> Result> { + fn parse<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { input.try(|i| SvgLengthOrPercentageOrNumber::parse(context, i)) .map(Into::into) .or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue)) @@ -77,8 +81,10 @@ pub type NonNegativeSvgLengthOrPercentageOrNumber = pub type SVGWidth = generic::SVGLength; impl Parse for SVGWidth { - fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) - -> Result> { + fn parse<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { input.try(|i| NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i)) .map(Into::into) .or_else(|_| parse_context_value(input, generic::SVGLength::ContextValue)) @@ -95,8 +101,10 @@ impl From for SVGWidth { pub type SVGStrokeDashArray = generic::SVGStrokeDashArray; impl Parse for SVGStrokeDashArray { - fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) - -> Result> { + fn parse<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { if let Ok(values) = input.try(|i| CommaWithSpace::parse(i, |i| { NonNegativeSvgLengthOrPercentageOrNumber::parse(context, i) })) {