Skip to content

Commit bb35e23

Browse files
committed
auto merge of #8896 : lightcatcher/rust/default_eq_fix, r=thestinger
Summary: -removed "ne" methods in libstd and librustpkg -made default "ne" be inlined -made one of the "eq" methods in librustpkg follow more standard parameter naming convention
2 parents 5fe553d + 1ab0dda commit bb35e23

File tree

11 files changed

+4
-26
lines changed

11 files changed

+4
-26
lines changed

src/librustpkg/package_id.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ pub struct PkgId {
3737
}
3838

3939
impl Eq for PkgId {
40-
fn eq(&self, p: &PkgId) -> bool {
41-
p.path == self.path && p.version == self.version
42-
}
43-
fn ne(&self, p: &PkgId) -> bool {
44-
!(self.eq(p))
40+
fn eq(&self, other: &PkgId) -> bool {
41+
self.path == other.path && self.version == other.version
4542
}
4643
}
4744

src/librustpkg/version.rs

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ impl Eq for Version {
4040
_ => false
4141
}
4242
}
43-
fn ne(&self, other: &Version) -> bool {
44-
!self.eq(other)
45-
}
4643
}
4744

4845
impl Ord for Version {

src/libstd/bool.rs

-2
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ impl TotalOrd for bool {
321321
impl Eq for bool {
322322
#[inline]
323323
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
324-
#[inline]
325-
fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
326324
}
327325

328326
#[cfg(not(test))]

src/libstd/char.rs

-2
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,6 @@ impl Char for char {
397397
impl Eq for char {
398398
#[inline]
399399
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
400-
#[inline]
401-
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
402400
}
403401

404402
#[cfg(not(test))]

src/libstd/cmp.rs

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ and `Eq` to overload the `==` and `!=` operators.
3636
#[lang="eq"]
3737
pub trait Eq {
3838
fn eq(&self, other: &Self) -> bool;
39+
40+
#[inline]
3941
fn ne(&self, other: &Self) -> bool { !self.eq(other) }
4042
}
4143

src/libstd/num/f32.rs

-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ impl Num for f32 {}
171171
impl Eq for f32 {
172172
#[inline]
173173
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
174-
#[inline]
175-
fn ne(&self, other: &f32) -> bool { (*self) != (*other) }
176174
}
177175

178176
#[cfg(not(test))]

src/libstd/num/f64.rs

-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ impl Num for f64 {}
194194
impl Eq for f64 {
195195
#[inline]
196196
fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
197-
#[inline]
198-
fn ne(&self, other: &f64) -> bool { (*self) != (*other) }
199197
}
200198

201199
#[cfg(not(test))]

src/libstd/num/float.rs

-2
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ impl Num for float {}
331331
impl Eq for float {
332332
#[inline]
333333
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
334-
#[inline]
335-
fn ne(&self, other: &float) -> bool { (*self) != (*other) }
336334
}
337335

338336
#[cfg(not(test))]

src/libstd/num/int_macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ impl Ord for $T {
147147
impl Eq for $T {
148148
#[inline]
149149
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
150-
#[inline]
151-
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
152150
}
153151
154152
impl Orderable for $T {

src/libstd/num/uint_macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ impl Ord for $T {
148148
impl Eq for $T {
149149
#[inline]
150150
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
151-
#[inline]
152-
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
153151
}
154152

155153
impl Orderable for $T {

src/libstd/str.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1180,17 +1180,13 @@ pub mod traits {
11801180
fn eq(&self, other: &~str) -> bool {
11811181
eq_slice((*self), (*other))
11821182
}
1183-
#[inline]
1184-
fn ne(&self, other: &~str) -> bool { !(*self).eq(other) }
11851183
}
11861184
11871185
impl Eq for @str {
11881186
#[inline]
11891187
fn eq(&self, other: &@str) -> bool {
11901188
eq_slice((*self), (*other))
11911189
}
1192-
#[inline]
1193-
fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
11941190
}
11951191
11961192
impl<'self> TotalEq for &'self str {

0 commit comments

Comments
 (0)