Skip to content

Removed some unnecessarily defined "ne" methods in Eq impls #8896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/librustpkg/package_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ pub struct PkgId {
}

impl Eq for PkgId {
fn eq(&self, p: &PkgId) -> bool {
p.path == self.path && p.version == self.version
}
fn ne(&self, p: &PkgId) -> bool {
!(self.eq(p))
fn eq(&self, other: &PkgId) -> bool {
self.path == other.path && self.version == other.version
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/librustpkg/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ impl Eq for Version {
_ => false
}
}
fn ne(&self, other: &Version) -> bool {
!self.eq(other)
}
}

impl Ord for Version {
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ impl TotalOrd for bool {
impl Eq for bool {
#[inline]
fn eq(&self, other: &bool) -> bool { (*self) == (*other) }
#[inline]
fn ne(&self, other: &bool) -> bool { (*self) != (*other) }
}

#[cfg(not(test))]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ impl Char for char {
impl Eq for char {
#[inline]
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
#[inline]
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
}

#[cfg(not(test))]
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and `Eq` to overload the `==` and `!=` operators.
#[lang="eq"]
pub trait Eq {
fn eq(&self, other: &Self) -> bool;

#[inline]
fn ne(&self, other: &Self) -> bool { !self.eq(other) }
}

Expand Down
2 changes: 0 additions & 2 deletions src/libstd/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ impl Num for f32 {}
impl Eq for f32 {
#[inline]
fn eq(&self, other: &f32) -> bool { (*self) == (*other) }
#[inline]
fn ne(&self, other: &f32) -> bool { (*self) != (*other) }
}

#[cfg(not(test))]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ impl Num for f64 {}
impl Eq for f64 {
#[inline]
fn eq(&self, other: &f64) -> bool { (*self) == (*other) }
#[inline]
fn ne(&self, other: &f64) -> bool { (*self) != (*other) }
}

#[cfg(not(test))]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/num/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ impl Num for float {}
impl Eq for float {
#[inline]
fn eq(&self, other: &float) -> bool { (*self) == (*other) }
#[inline]
fn ne(&self, other: &float) -> bool { (*self) != (*other) }
}

#[cfg(not(test))]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ impl Ord for $T {
impl Eq for $T {
#[inline]
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
#[inline]
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
}

impl Orderable for $T {
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ impl Ord for $T {
impl Eq for $T {
#[inline]
fn eq(&self, other: &$T) -> bool { return (*self) == (*other); }
#[inline]
fn ne(&self, other: &$T) -> bool { return (*self) != (*other); }
}

impl Orderable for $T {
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,17 +1180,13 @@ pub mod traits {
fn eq(&self, other: &~str) -> bool {
eq_slice((*self), (*other))
}
#[inline]
fn ne(&self, other: &~str) -> bool { !(*self).eq(other) }
}

impl Eq for @str {
#[inline]
fn eq(&self, other: &@str) -> bool {
eq_slice((*self), (*other))
}
#[inline]
fn ne(&self, other: &@str) -> bool { !(*self).eq(other) }
}

impl<'self> TotalEq for &'self str {
Expand Down