style: Use Option::get_or_insert_with.

Less unwraps is better.
This commit is contained in:
Emilio Cobos Álvarez 2018-01-10 03:35:26 +01:00
parent bfc91c5e12
commit 3595c98411
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 27 additions and 31 deletions

View file

@ -2271,10 +2271,9 @@ impl CascadeData {
);
let style_rule_cascade_data = if selector.is_slotted() {
if self.slotted_rule_data.is_none() {
self.slotted_rule_data = Some(Box::new(StyleRuleCascadeData::new()));
}
self.slotted_rule_data.as_mut().unwrap()
self.slotted_rule_data.get_or_insert_with(|| {
Box::new(StyleRuleCascadeData::new())
})
} else {
&mut self.normal_rule_data
};