]> git.lizzy.rs Git - rust.git/commitdiff
Remove into_vec method from &[T]
authorBoris Egorov <egorov@linux.com>
Sat, 11 Oct 2014 06:03:55 +0000 (13:03 +0700)
committerBoris Egorov <egorov@linux.com>
Sat, 11 Oct 2014 09:22:43 +0000 (16:22 +0700)
[breaking-change]
Closes #17916

src/libcollections/slice.rs
src/libcollections/vec.rs
src/libgraphviz/maybe_owned_vec.rs
src/librustc/middle/traits/select.rs

index 955a1a5068bcf903bc00e0fa73ce58a341c3fe5d..1cda1e93959701b586540a5668510e1e130d1e14 100644 (file)
@@ -277,12 +277,14 @@ fn to_owned(&self) -> Vec<T> {
     }
 
     /// Converts `self` into an owned vector, not making a copy if possible.
+    /// Deprecated. Use 'to_vec'
+    #[deprecated = "Replaced by `to_vec`"]
     fn into_vec(self) -> Vec<T>;
 
-    /// Deprecated. Use `into_vec`
-    #[deprecated = "Replaced by `into_vec`"]
+    /// Deprecated. Use `to_vec`
+    #[deprecated = "Replaced by `to_vec`"]
     fn into_owned(self) -> Vec<T> {
-        self.into_vec()
+        self.to_vec()
     }
 }
 
@@ -2328,9 +2330,9 @@ fn test_mut_last() {
     }
 
     #[test]
-    fn test_into_vec() {
+    fn test_to_vec() {
         let xs = box [1u, 2, 3];
-        let ys = xs.into_vec();
+        let ys = xs.to_vec();
         assert_eq!(ys.as_slice(), [1u, 2, 3].as_slice());
     }
 }
index a82856c013d647d7a600bbc4669b9b2320a3786b..e456f8811c70c411c5f47135fe1ded9881bee8a1 100644 (file)
@@ -614,13 +614,6 @@ fn len(&self) -> uint {
     }
 }
 
-impl<T: Clone> CloneableVector<T> for Vec<T> {
-    #[deprecated = "call .clone() instead"]
-    fn to_vec(&self) -> Vec<T> { self.clone() }
-    #[deprecated = "move the vector instead"]
-    fn into_vec(self) -> Vec<T> { self }
-}
-
 // FIXME: #13996: need a way to mark the return value as `noalias`
 #[inline(never)]
 unsafe fn alloc_or_realloc<T>(ptr: *mut T, old_size: uint, size: uint) -> *mut T {
index 50d957e1381829999a01f9ef597f7d5c17b7e2af..f67a9c2c84ce71bab5d5c1cabf9a3b2271c17592 100644 (file)
@@ -140,7 +140,7 @@ fn into_vec(self) -> Vec<T> {
 impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> {
     fn clone(&self) -> MaybeOwnedVector<'a, T> {
         match *self {
-            Growable(ref v) => Growable(v.to_vec()),
+            Growable(ref v) => Growable(v.clone()),
             Borrowed(v) => Borrowed(v)
         }
     }
index 305528a9af8fa95806eec0ab2e5eaee27607a4a3..4040b452e998852f6d57b49e1fb458c753476847 100644 (file)
@@ -1014,7 +1014,7 @@ fn builtin_bound(&mut self,
 
             ty::ty_tup(ref tys) => {
                 // (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
-                Ok(If(tys.to_owned()))
+                Ok(If(tys.clone()))
             }
 
             ty::ty_unboxed_closure(def_id, _) => {