diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 0fffb440d01..85f8ec9281f 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -1185,12 +1185,12 @@ impl Animatable for LengthOrPercentageOrAuto { (this, other) => { let this: Option = From::from(this); let other: Option = From::from(other); - if this.is_none() || other.is_none() { - Err(()) - } else { - let length_diff = (this.unwrap().length().0 - other.unwrap().length().0) as f64; - let percentage_diff = (this.unwrap().percentage() - other.unwrap().percentage()) as f64; + if let (Some(this), Some(other)) = (this, other) { + let length_diff = (this.length().0 - other.length().0) as f64; + let percentage_diff = (this.percentage() - other.percentage()) as f64; Ok(length_diff * length_diff + percentage_diff * percentage_diff) + } else { + Err(()) } } }