diff options
author | bors-servo <release+servo@mozilla.com> | 2014-04-30 06:32:43 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-04-30 06:32:43 -0400 |
commit | 8af9ce07f8ec9dddc926c1f76ade9e84427034db (patch) | |
tree | a53462a48201f442eb92a2e1db6363968d25e36b | |
parent | b2e64704e220f7cff165fd43e1eebea19657104d (diff) | |
parent | 3c271264775123444fee627fff5812f70cda530e (diff) | |
download | servo-8af9ce07f8ec9dddc926c1f76ade9e84427034db.tar.gz servo-8af9ce07f8ec9dddc926c1f76ade9e84427034db.zip |
auto merge of #2272 : mbrubeck/servo/geometry-cleanup, r=Ms2ger
This code did not use derived traits previously because their methods were not inlined, but this was fixed in mozilla/rust#10557. r? @pcwalton
-rw-r--r-- | src/components/util/geometry.rs | 62 |
1 files changed, 1 insertions, 61 deletions
diff --git a/src/components/util/geometry.rs b/src/components/util/geometry.rs index 6fd74144b05..9b371c7565b 100644 --- a/src/components/util/geometry.rs +++ b/src/components/util/geometry.rs @@ -12,38 +12,15 @@ use std::fmt; // An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was // originally proposed in 2002 as a standard unit of measure in Gecko. // See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info. +#[deriving(Clone, Eq, Ord, Zero)] pub struct Au(pub i32); -// We don't use #[deriving] here for inlining. -impl Clone for Au { - #[inline] - fn clone(&self) -> Au { - let Au(i) = *self; - Au(i) - } -} - impl fmt::Show for Au { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Au(n) = *self; write!(f.buf, "Au({})", n) }} -impl Eq for Au { - #[inline] - fn eq(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s == o - } - #[inline] - fn ne(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s != o - } -} - impl Add<Au,Au> for Au { #[inline] fn add(&self, other: &Au) -> Au { @@ -98,48 +75,11 @@ impl Neg<Au> for Au { } } -impl Ord for Au { - #[inline] - fn lt(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s < o - } - #[inline] - fn le(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s <= o - } - #[inline] - fn ge(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s >= o - } - #[inline] - fn gt(&self, other: &Au) -> bool { - let Au(s) = *self; - let Au(o) = *other; - s > o - } -} - impl One for Au { #[inline] fn one() -> Au { Au(1) } } -impl Zero for Au { - #[inline] - fn zero() -> Au { Au(0) } - #[inline] - fn is_zero(&self) -> bool { - let Au(s) = *self; - s == 0 - } -} - impl Num for Au {} #[inline] |