mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Use ? in Option more often.
This commit is contained in:
parent
5f4f355cea
commit
dbf0183b0f
2 changed files with 13 additions and 23 deletions
|
@ -140,15 +140,10 @@ impl<'a> Iterator for NormalDeclarationIterator<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let next = self.0.iter.next();
|
||||
match next {
|
||||
Some((decl, importance)) => {
|
||||
let (decl, importance) = self.0.iter.next()?;
|
||||
if !importance {
|
||||
return Some(decl);
|
||||
}
|
||||
},
|
||||
None => return None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,11 +182,7 @@ impl<'a, 'cx, 'cx_a:'cx> Iterator for AnimationValueIterator<'a, 'cx, 'cx_a> {
|
|||
#[inline]
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
loop {
|
||||
let next = self.iter.next();
|
||||
let decl = match next {
|
||||
Some(decl) => decl,
|
||||
None => return None,
|
||||
};
|
||||
let decl = self.iter.next()?;
|
||||
|
||||
let animation = AnimationValue::from_declaration(
|
||||
decl,
|
||||
|
|
|
@ -850,10 +850,12 @@ impl ShorthandId {
|
|||
/// Finds and returns an appendable value for the given declarations.
|
||||
///
|
||||
/// Returns the optional appendable value.
|
||||
pub fn get_shorthand_appendable_value<'a, I>(self,
|
||||
declarations: I)
|
||||
-> Option<AppendableValue<'a, I::IntoIter>>
|
||||
where I: IntoIterator<Item=&'a PropertyDeclaration>,
|
||||
pub fn get_shorthand_appendable_value<'a, I>(
|
||||
self,
|
||||
declarations: I,
|
||||
) -> Option<AppendableValue<'a, I::IntoIter>>
|
||||
where
|
||||
I: IntoIterator<Item=&'a PropertyDeclaration>,
|
||||
I::IntoIter: Clone,
|
||||
{
|
||||
let declarations = declarations.into_iter();
|
||||
|
@ -862,10 +864,7 @@ impl ShorthandId {
|
|||
let mut declarations2 = declarations.clone();
|
||||
let mut declarations3 = declarations.clone();
|
||||
|
||||
let first_declaration = match declarations2.next() {
|
||||
Some(declaration) => declaration,
|
||||
None => return None
|
||||
};
|
||||
let first_declaration = declarations2.next()?;
|
||||
|
||||
// https://drafts.csswg.org/css-variables/#variables-in-shorthands
|
||||
if let Some(css) = first_declaration.with_variables_from_shorthand(self) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue