mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 19:33:16 +00:00
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
This commit is contained in:
commit
bb35e23f1c
@ -37,11 +37,8 @@ pub struct PkgId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for PkgId {
|
impl Eq for PkgId {
|
||||||
fn eq(&self, p: &PkgId) -> bool {
|
fn eq(&self, other: &PkgId) -> bool {
|
||||||
p.path == self.path && p.version == self.version
|
self.path == other.path && self.version == other.version
|
||||||
}
|
|
||||||
fn ne(&self, p: &PkgId) -> bool {
|
|
||||||
!(self.eq(p))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +40,6 @@ impl Eq for Version {
|
|||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn ne(&self, other: &Version) -> bool {
|
|
||||||
!self.eq(other)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for Version {
|
impl Ord for Version {
|
||||||
|
@ -321,8 +321,6 @@ impl TotalOrd for bool {
|
|||||||
impl Eq for bool {
|
impl Eq for bool {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
|
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -397,8 +397,6 @@ impl Char for char {
|
|||||||
impl Eq for char {
|
impl Eq for char {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
|
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -36,6 +36,8 @@ and `Eq` to overload the `==` and `!=` operators.
|
|||||||
#[lang="eq"]
|
#[lang="eq"]
|
||||||
pub trait Eq {
|
pub trait Eq {
|
||||||
fn eq(&self, other: &Self) -> bool;
|
fn eq(&self, other: &Self) -> bool;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn ne(&self, other: &Self) -> bool { !self.eq(other) }
|
fn ne(&self, other: &Self) -> bool { !self.eq(other) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +171,6 @@ impl Num for f32 {}
|
|||||||
impl Eq for f32 {
|
impl Eq for f32 {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
|
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &f32) -> bool { (*self) != (*other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -194,8 +194,6 @@ impl Num for f64 {}
|
|||||||
impl Eq for f64 {
|
impl Eq for f64 {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
|
fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &f64) -> bool { (*self) != (*other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -331,8 +331,6 @@ impl Num for float {}
|
|||||||
impl Eq for float {
|
impl Eq for float {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
|
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &float) -> bool { (*self) != (*other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
@ -147,8 +147,6 @@ impl Ord for $T {
|
|||||||
impl Eq for $T {
|
impl Eq for $T {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
|
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Orderable for $T {
|
impl Orderable for $T {
|
||||||
|
@ -148,8 +148,6 @@ impl Ord for $T {
|
|||||||
impl Eq for $T {
|
impl Eq for $T {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
|
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Orderable for $T {
|
impl Orderable for $T {
|
||||||
|
@ -1180,8 +1180,6 @@ pub mod traits {
|
|||||||
fn eq(&self, other: &~str) -> bool {
|
fn eq(&self, other: &~str) -> bool {
|
||||||
eq_slice((*self), (*other))
|
eq_slice((*self), (*other))
|
||||||
}
|
}
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &~str) -> bool { !(*self).eq(other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for @str {
|
impl Eq for @str {
|
||||||
@ -1189,8 +1187,6 @@ pub mod traits {
|
|||||||
fn eq(&self, other: &@str) -> bool {
|
fn eq(&self, other: &@str) -> bool {
|
||||||
eq_slice((*self), (*other))
|
eq_slice((*self), (*other))
|
||||||
}
|
}
|
||||||
#[inline]
|
|
||||||
fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'self> TotalEq for &'self str {
|
impl<'self> TotalEq for &'self str {
|
||||||
|
Loading…
Reference in New Issue
Block a user