mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Use Option::get_or_insert_with.
Less unwraps is better.
This commit is contained in:
parent
bfc91c5e12
commit
3595c98411
2 changed files with 27 additions and 31 deletions
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue