]> git.lizzy.rs Git - rust.git/blobdiff - src/libcollections/vec.rs
make `IndexMut` a super trait over `Index`
[rust.git] / src / libcollections / vec.rs
index c6c8beec870172178c42568ef47a24aecffad1dc..4a082c3616cb91bbfe2d5d1e2332f201f5f4ecbb 100644 (file)
@@ -1286,8 +1286,6 @@ fn index(&self, index: &usize) -> &T {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> IndexMut<usize> for Vec<T> {
-    type Output = T;
-
     #[inline]
     fn index_mut(&mut self, index: &usize) -> &mut T {
         // NB built-in indexing via `&mut [T]`
@@ -1331,7 +1329,6 @@ fn index(&self, _index: &ops::RangeFull) -> &[T] {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
-    type Output = [T];
     #[inline]
     fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1339,7 +1336,6 @@ fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
-    type Output = [T];
     #[inline]
     fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1347,7 +1343,6 @@ fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
-    type Output = [T];
     #[inline]
     fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
         IndexMut::index_mut(&mut **self, index)
@@ -1355,7 +1350,6 @@ fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
 }
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
-    type Output = [T];
     #[inline]
     fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] {
         self.as_mut_slice()
@@ -2146,10 +2140,10 @@ fn zero_sized_values() {
 
     #[test]
     fn test_partition() {
-        assert_eq!(vec![].into_iter().partition(|x: &int| *x < 3), (vec![], vec![]));
-        assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 4), (vec![1, 2, 3], vec![]));
-        assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 2), (vec![1], vec![2, 3]));
-        assert_eq!(vec![1, 2, 3].into_iter().partition(|x: &int| *x < 0), (vec![], vec![1, 2, 3]));
+        assert_eq!(vec![].into_iter().partition(|x: &i32| *x < 3), (vec![], vec![]));
+        assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 4), (vec![1, 2, 3], vec![]));
+        assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 2), (vec![1], vec![2, 3]));
+        assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 0), (vec![], vec![1, 2, 3]));
     }
 
     #[test]
@@ -2183,7 +2177,7 @@ fn test_unsafe_ptrs() {
     #[test]
     fn test_vec_truncate_drop() {
         static mut drops: u32 = 0;
-        struct Elem(int);
+        struct Elem(i32);
         impl Drop for Elem {
             fn drop(&mut self) {
                 unsafe { drops += 1; }