mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Use the ? operator for Option
This commit is contained in:
parent
c52d347022
commit
3005a26daf
13 changed files with 47 additions and 129 deletions
|
@ -102,20 +102,16 @@ impl RuleCache {
|
|||
return None;
|
||||
}
|
||||
|
||||
let rules = match builder_with_early_props.rules {
|
||||
Some(ref rules) => rules,
|
||||
None => return None,
|
||||
};
|
||||
let rules = builder_with_early_props.rules.as_ref()?;
|
||||
let cached_values = self.map.get(rules)?;
|
||||
|
||||
self.map.get(rules).and_then(|cached_values| {
|
||||
for &(ref conditions, ref values) in cached_values.iter() {
|
||||
if conditions.matches(builder_with_early_props) {
|
||||
debug!("Using cached reset style with conditions {:?}", conditions);
|
||||
return Some(&**values)
|
||||
}
|
||||
for &(ref conditions, ref values) in cached_values.iter() {
|
||||
if conditions.matches(builder_with_early_props) {
|
||||
debug!("Using cached reset style with conditions {:?}", conditions);
|
||||
return Some(&**values)
|
||||
}
|
||||
None
|
||||
})
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Inserts a node into the rules cache if possible.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue