mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Run rustfmt on selectors, servo_arc, and style.
This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
This commit is contained in:
parent
f7ae1a37e3
commit
c99bcdd4b8
181 changed files with 9981 additions and 7933 deletions
|
@ -72,24 +72,16 @@ where
|
|||
#[inline]
|
||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||
if procedure == Procedure::Add {
|
||||
return Ok(ShadowList(
|
||||
self.0.iter().chain(&other.0).cloned().collect(),
|
||||
));
|
||||
return Ok(ShadowList(self.0.iter().chain(&other.0).cloned().collect()));
|
||||
}
|
||||
// FIXME(nox): Use itertools here, to avoid the need for `unreachable!`.
|
||||
let max_len = cmp::max(self.0.len(), other.0.len());
|
||||
let mut shadows = Vec::with_capacity(max_len);
|
||||
for i in 0..max_len {
|
||||
shadows.push(match (self.0.get(i), other.0.get(i)) {
|
||||
(Some(shadow), Some(other)) => {
|
||||
shadow.animate(other, procedure)?
|
||||
},
|
||||
(Some(shadow), None) => {
|
||||
shadow.animate(&shadow.to_animated_zero()?, procedure)?
|
||||
},
|
||||
(None, Some(shadow)) => {
|
||||
shadow.to_animated_zero()?.animate(shadow, procedure)?
|
||||
},
|
||||
(Some(shadow), Some(other)) => shadow.animate(other, procedure)?,
|
||||
(Some(shadow), None) => shadow.animate(&shadow.to_animated_zero()?, procedure)?,
|
||||
(None, Some(shadow)) => shadow.to_animated_zero()?.animate(shadow, procedure)?,
|
||||
(None, None) => unreachable!(),
|
||||
});
|
||||
}
|
||||
|
@ -105,16 +97,16 @@ where
|
|||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
use itertools::{EitherOrBoth, Itertools};
|
||||
|
||||
self.0.iter().zip_longest(other.0.iter()).map(|it| {
|
||||
match it {
|
||||
EitherOrBoth::Both(from, to) => {
|
||||
from.compute_squared_distance(to)
|
||||
},
|
||||
self.0
|
||||
.iter()
|
||||
.zip_longest(other.0.iter())
|
||||
.map(|it| match it {
|
||||
EitherOrBoth::Both(from, to) => from.compute_squared_distance(to),
|
||||
EitherOrBoth::Left(list) | EitherOrBoth::Right(list) => {
|
||||
list.compute_squared_distance(&list.to_animated_zero()?)
|
||||
},
|
||||
}
|
||||
}).sum()
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,10 +137,8 @@ impl ComputeSquaredDistance for BoxShadow {
|
|||
if self.inset != other.inset {
|
||||
return Err(());
|
||||
}
|
||||
Ok(
|
||||
self.base.compute_squared_distance(&other.base)? +
|
||||
self.spread.compute_squared_distance(&other.spread)?,
|
||||
)
|
||||
Ok(self.base.compute_squared_distance(&other.base)? +
|
||||
self.spread.compute_squared_distance(&other.spread)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue