mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Use match
instead of if let
of one-line branches.
This commit is contained in:
parent
34c5a21691
commit
09d6c83c50
1 changed files with 10 additions and 9 deletions
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue