diff options
| author | bors <bors@rust-lang.org> | 2014-03-23 08:36:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-23 08:36:51 -0700 |
| commit | 903e83889ade166bf62f1ee74df8bf8331ea17d1 (patch) | |
| tree | 2d2c838f7adc52628632948a8b37820c4f03ed75 /src/libstd/tuple.rs | |
| parent | cafb7ed6f671a0102c4df9abad43b747c00f5cdf (diff) | |
| parent | f6db0ef9464a17fa6e547e755b1b5dfa09af9499 (diff) | |
| download | rust-903e83889ade166bf62f1ee74df8bf8331ea17d1.tar.gz rust-903e83889ade166bf62f1ee74df8bf8331ea17d1.zip | |
auto merge of #13102 : huonw/rust/totaleq-deriving, r=thestinger
std: remove the `equals` method from `TotalEq`. `TotalEq` is now just an assertion about the `Eq` impl of a type (i.e. `==` is a total equality if a type implements `TotalEq`) so the extra method is just confusing. Also, a new method magically appeared as a hack to allow deriving to assert that the contents of a struct/enum are also TotalEq, because the deriving infrastructure makes it very hard to do anything but create a trait method. (You didn't hear about this horrible work-around from me :(.)
Diffstat (limited to 'src/libstd/tuple.rs')
| -rw-r--r-- | src/libstd/tuple.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs index e9125dde011..c4ce6b5ae66 100644 --- a/src/libstd/tuple.rs +++ b/src/libstd/tuple.rs @@ -75,12 +75,7 @@ macro_rules! tuple_impls { } #[cfg(not(test))] - impl<$($T:TotalEq),+> TotalEq for ($($T,)+) { - #[inline] - fn equals(&self, other: &($($T,)+)) -> bool { - $(self.$refN().equals(other.$refN()))&&+ - } - } + impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {} #[cfg(not(test))] impl<$($T:Ord + Eq),+> Ord for ($($T,)+) { @@ -338,12 +333,6 @@ mod tests { assert!(((1.0, 2.0) < (2.0, nan))); assert!(!((2.0, 2.0) < (2.0, nan))); - // TotalEq - assert!(small.equals(&small)); - assert!(big.equals(&big)); - assert!(!small.equals(&big)); - assert!(!big.equals(&small)); - // TotalOrd assert!(small.cmp(&small) == Equal); assert!(big.cmp(&big) == Equal); |
