mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
style: Derive more.
Differential Revision: https://phabricator.services.mozilla.com/D17029
This commit is contained in:
parent
137e735d9d
commit
af1bbd7b06
8 changed files with 14 additions and 91 deletions
|
@ -31,7 +31,7 @@ pub trait ComputeSquaredDistance {
|
|||
}
|
||||
|
||||
/// A distance between two animatable values.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Add, Clone, Copy, Debug, From)]
|
||||
pub struct SquaredDistance {
|
||||
value: f64,
|
||||
}
|
||||
|
@ -114,24 +114,6 @@ impl SquaredDistance {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<SquaredDistance> for f64 {
|
||||
#[inline]
|
||||
fn from(distance: SquaredDistance) -> Self {
|
||||
distance.value
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for SquaredDistance {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn add(self, rhs: Self) -> Self {
|
||||
SquaredDistance {
|
||||
value: self.value + rhs.value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Sum for SquaredDistance {
|
||||
fn sum<I>(iter: I) -> Self
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue