mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
clippy: Fix option_map_unit_fn warnings (#31906)
This commit is contained in:
parent
a5bcae212a
commit
da76ebabe9
11 changed files with 43 additions and 30 deletions
|
@ -144,14 +144,18 @@ impl CSSRuleList {
|
|||
RulesSource::Rules(ref css_rules) => {
|
||||
css_rules.write_with(&mut guard).remove_rule(index)?;
|
||||
let mut dom_rules = self.dom_rules.borrow_mut();
|
||||
dom_rules[index].get().map(|r| r.detach());
|
||||
if let Some(r) = dom_rules[index].get() {
|
||||
r.detach()
|
||||
}
|
||||
dom_rules.remove(index);
|
||||
Ok(())
|
||||
},
|
||||
RulesSource::Keyframes(ref kf) => {
|
||||
// https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-deleterule
|
||||
let mut dom_rules = self.dom_rules.borrow_mut();
|
||||
dom_rules[index].get().map(|r| r.detach());
|
||||
if let Some(r) = dom_rules[index].get() {
|
||||
r.detach()
|
||||
}
|
||||
dom_rules.remove(index);
|
||||
kf.write_with(&mut guard).keyframes.remove(index);
|
||||
Ok(())
|
||||
|
@ -162,7 +166,9 @@ impl CSSRuleList {
|
|||
// Remove parent stylesheets from all children
|
||||
pub fn deparent_all(&self) {
|
||||
for rule in self.dom_rules.borrow().iter() {
|
||||
rule.get().map(|r| DomRoot::upcast(r).deparent());
|
||||
if let Some(r) = rule.get() {
|
||||
DomRoot::upcast(r).deparent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue