Use match instead of if let of one-line branches.

This commit is contained in:
Simon Sapin 2017-07-13 16:58:19 +02:00
parent 34c5a21691
commit 09d6c83c50

View file

@ -2821,15 +2821,16 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
CascadeLevel::UserNormal | CascadeLevel::UserNormal |
CascadeLevel::UserImportant | CascadeLevel::UserImportant |
CascadeLevel::UAImportant) { CascadeLevel::UAImportant) {
let non_transparent_background; let non_transparent_background = match *declaration {
if let PropertyDeclaration::BackgroundColor(ref color) = *declaration { PropertyDeclaration::BackgroundColor(ref color) => {
// Treat background-color a bit differently. If the specified // Treat background-color a bit differently. If the specified
// color is anything other than a fully transparent color, convert // color is anything other than a fully transparent color, convert
// it into the Device's default background color. // it into the Device's default background color.
non_transparent_background = color.is_non_transparent(); color.is_non_transparent()
} else { }
continue _ => continue
} };
// FIXME: moving this out of `match` is a work around for borrows being lexical.
if non_transparent_background { if non_transparent_background {
declaration = Cow::Borrowed(default_background_color_decl.as_ref().unwrap()); declaration = Cow::Borrowed(default_background_color_decl.as_ref().unwrap());
} }