Skip to content

Commit 1d6959b

Browse files
committed
servo: Merge #2272 - Use derived traits for Au (from mbrubeck:geometry-cleanup); r=Ms2ger
This code did not use derived traits previously because their methods were not inlined, but this was fixed in rust-lang/rust#10557. r? pcwalton Source-Repo: https://github.com/servo/servo Source-Revision: 8af9ce07f8ec9dddc926c1f76ade9e84427034db UltraBlame original commit: de3f2703b11e0d467bf92c052904cb1cfd484a9c
1 parent 7785e92 commit 1d6959b

File tree

1 file changed

+1
-61
lines changed

1 file changed

+1
-61
lines changed

servo/src/components/util/geometry.rs

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,15 @@ use std::fmt;
1212

1313

1414

15+
#[deriving(Clone, Eq, Ord, Zero)]
1516
pub struct Au(pub i32);
1617

17-
18-
impl Clone for Au {
19-
#[inline]
20-
fn clone(&self) -> Au {
21-
let Au(i) = *self;
22-
Au(i)
23-
}
24-
}
25-
2618
impl fmt::Show for Au {
2719
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2820
let Au(n) = *self;
2921
write!(f.buf, "Au({})", n)
3022
}}
3123

32-
impl Eq for Au {
33-
#[inline]
34-
fn eq(&self, other: &Au) -> bool {
35-
let Au(s) = *self;
36-
let Au(o) = *other;
37-
s == o
38-
}
39-
#[inline]
40-
fn ne(&self, other: &Au) -> bool {
41-
let Au(s) = *self;
42-
let Au(o) = *other;
43-
s != o
44-
}
45-
}
46-
4724
impl Add<Au,Au> for Au {
4825
#[inline]
4926
fn add(&self, other: &Au) -> Au {
@@ -98,48 +75,11 @@ impl Neg<Au> for Au {
9875
}
9976
}
10077

101-
impl Ord for Au {
102-
#[inline]
103-
fn lt(&self, other: &Au) -> bool {
104-
let Au(s) = *self;
105-
let Au(o) = *other;
106-
s < o
107-
}
108-
#[inline]
109-
fn le(&self, other: &Au) -> bool {
110-
let Au(s) = *self;
111-
let Au(o) = *other;
112-
s <= o
113-
}
114-
#[inline]
115-
fn ge(&self, other: &Au) -> bool {
116-
let Au(s) = *self;
117-
let Au(o) = *other;
118-
s >= o
119-
}
120-
#[inline]
121-
fn gt(&self, other: &Au) -> bool {
122-
let Au(s) = *self;
123-
let Au(o) = *other;
124-
s > o
125-
}
126-
}
127-
12878
impl One for Au {
12979
#[inline]
13080
fn one() -> Au { Au(1) }
13181
}
13282

133-
impl Zero for Au {
134-
#[inline]
135-
fn zero() -> Au { Au(0) }
136-
#[inline]
137-
fn is_zero(&self) -> bool {
138-
let Au(s) = *self;
139-
s == 0
140-
}
141-
}
142-
14383
impl Num for Au {}
14484

14585
#[inline]

0 commit comments

Comments
 (0)