style: Make weird color parsing marginally faster.

This commit is contained in:
Emilio Cobos Álvarez 2018-03-08 14:08:54 +01:00
parent 2192090ea5
commit 0717047e1e
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 8 additions and 8 deletions

View file

@ -160,12 +160,14 @@ impl Parse for Color {
Err(e) => {
#[cfg(feature = "gecko")]
{
if let Ok(system) = input.try(SystemColor::parse) {
return Ok(Color::System(system));
}
if let Ok(ident) = input.expect_ident() {
if let Ok(system) = SystemColor::from_ident(ident) {
return Ok(Color::System(system));
}
if let Ok(c) = gecko::SpecialColorKeyword::parse(input) {
return Ok(Color::Special(c));
if let Ok(c) = gecko::SpecialColorKeyword::from_ident(ident) {
return Ok(Color::Special(c));
}
}
}