From 09d6c83c50cfda76361b4155ad36b3617f2f5c6b Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 13 Jul 2017 16:58:19 +0200 Subject: [PATCH] Use `match` instead of `if let` of one-line branches. --- .../style/properties/properties.mako.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 8cccbf342da1..25c6de05f11a 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -2821,15 +2821,16 @@ pub fn apply_declarations<'a, F, I>(device: &Device, CascadeLevel::UserNormal | CascadeLevel::UserImportant | CascadeLevel::UAImportant) { - let non_transparent_background; - if let PropertyDeclaration::BackgroundColor(ref color) = *declaration { - // Treat background-color a bit differently. If the specified - // color is anything other than a fully transparent color, convert - // it into the Device's default background color. - non_transparent_background = color.is_non_transparent(); - } else { - continue - } + let non_transparent_background = match *declaration { + PropertyDeclaration::BackgroundColor(ref color) => { + // Treat background-color a bit differently. If the specified + // color is anything other than a fully transparent color, convert + // it into the Device's default background color. + color.is_non_transparent() + } + _ => continue + }; + // FIXME: moving this out of `match` is a work around for borrows being lexical. if non_transparent_background { declaration = Cow::Borrowed(default_background_color_decl.as_ref().unwrap()); }