style: Early return in a couple of places to deindent some code.

MozReview-Commit-ID: 8hDAKZANOro
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-09-25 14:53:58 +02:00
parent d9cec56d71
commit 3067d2e320
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -182,8 +182,9 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue,ParseError<'i>> {
if let Ok(()) = input.try(|i| i.expect_ident_matching("normal")) {
Ok(SpecifiedValue(0))
} else {
return Ok(SpecifiedValue(0))
}
let mut value = 0;
// bitfield representing what we've seen so far
// bit 1 is fill, bit 2 is stroke, bit 3 is markers
@ -204,20 +205,21 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
if (seen & (1 << val)) != 0 {
// don't parse the same ident twice
return Err(StyleParseError::UnspecifiedError.into())
} else {
}
value |= val << (pos * SHIFT);
seen |= 1 << val;
pos += 1;
}
}
Err(_) => break,
}
}
if value == 0 {
// couldn't find any keyword
Err(StyleParseError::UnspecifiedError.into())
} else {
return Err(StyleParseError::UnspecifiedError.into())
}
// fill in rest
for i in pos..COUNT {
for paint in &ALL {
@ -232,8 +234,6 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
Ok(SpecifiedValue(value))
}
}
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {