diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-01-02 13:56:28 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-01-07 10:46:33 +1300 |
| commit | f7ff37e4c52a1d6562635fcd5bab6309cf75ea08 (patch) | |
| tree | 9c69736bf3830f9048f61d45943bf0fa6326782d /src/libcore/array.rs | |
| parent | 918255ef8c3c21b2009204c3019239f8dc9f46bf (diff) | |
| download | rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.tar.gz rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.zip | |
Replace full slice notation with index calls
Diffstat (limited to 'src/libcore/array.rs')
| -rw-r--r-- | src/libcore/array.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs index ba7714ad9bc..37a2177b38d 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -18,7 +18,7 @@ use clone::Clone; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; use fmt; use kinds::Copy; -use ops::Deref; +use ops::{Deref, FullRange, Index}; use option::Option; // macro for implementing n-ary tuple functions and operations @@ -35,7 +35,7 @@ macro_rules! array_impls { #[unstable = "waiting for Show to stabilize"] impl<T:fmt::Show> fmt::Show for [T; $N] { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Show::fmt(&self[], f) + fmt::Show::fmt(&self.index(&FullRange), f) } } @@ -43,11 +43,11 @@ macro_rules! array_impls { impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> { #[inline] fn eq(&self, other: &[B; $N]) -> bool { - self[] == other[] + self.index(&FullRange) == other.index(&FullRange) } #[inline] fn ne(&self, other: &[B; $N]) -> bool { - self[] != other[] + self.index(&FullRange) != other.index(&FullRange) } } @@ -57,9 +57,9 @@ macro_rules! array_impls { Rhs: Deref<Target=[B]>, { #[inline(always)] - fn eq(&self, other: &Rhs) -> bool { PartialEq::eq(self[], &**other) } + fn eq(&self, other: &Rhs) -> bool { PartialEq::eq(self.index(&FullRange), &**other) } #[inline(always)] - fn ne(&self, other: &Rhs) -> bool { PartialEq::ne(self[], &**other) } + fn ne(&self, other: &Rhs) -> bool { PartialEq::ne(self.index(&FullRange), &**other) } } #[stable] @@ -68,9 +68,9 @@ macro_rules! array_impls { Lhs: Deref<Target=[A]> { #[inline(always)] - fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other[]) } + fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other.index(&FullRange)) } #[inline(always)] - fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other[]) } + fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other.index(&FullRange)) } } #[stable] @@ -80,23 +80,23 @@ macro_rules! array_impls { impl<T:PartialOrd> PartialOrd for [T; $N] { #[inline] fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> { - PartialOrd::partial_cmp(&self[], &other[]) + PartialOrd::partial_cmp(&self.index(&FullRange), &other.index(&FullRange)) } #[inline] fn lt(&self, other: &[T; $N]) -> bool { - PartialOrd::lt(&self[], &other[]) + PartialOrd::lt(&self.index(&FullRange), &other.index(&FullRange)) } #[inline] fn le(&self, other: &[T; $N]) -> bool { - PartialOrd::le(&self[], &other[]) + PartialOrd::le(&self.index(&FullRange), &other.index(&FullRange)) } #[inline] fn ge(&self, other: &[T; $N]) -> bool { - PartialOrd::ge(&self[], &other[]) + PartialOrd::ge(&self.index(&FullRange), &other.index(&FullRange)) } #[inline] fn gt(&self, other: &[T; $N]) -> bool { - PartialOrd::gt(&self[], &other[]) + PartialOrd::gt(&self.index(&FullRange), &other.index(&FullRange)) } } @@ -104,7 +104,7 @@ macro_rules! array_impls { impl<T:Ord> Ord for [T; $N] { #[inline] fn cmp(&self, other: &[T; $N]) -> Ordering { - Ord::cmp(&self[], &other[]) + Ord::cmp(&self.index(&FullRange), &other.index(&FullRange)) } } )+ |
