about summary refs log tree commit diff
path: root/src/libstd/tuple.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-07-02 12:47:32 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-07-17 14:57:51 -0700
commit99b33f721954bc5290f9201c8f64003c294d0571 (patch)
tree786c9bf75d54512d0a80f6975ad40516ab432c3a /src/libstd/tuple.rs
parentb4e674f6e662bc80f2e7a5a1a9834f2152f08d32 (diff)
downloadrust-99b33f721954bc5290f9201c8f64003c294d0571.tar.gz
rust-99b33f721954bc5290f9201c8f64003c294d0571.zip
librustc: Remove all uses of "copy".
Diffstat (limited to 'src/libstd/tuple.rs')
-rw-r--r--src/libstd/tuple.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs
index 45702546278..841be4df6e2 100644
--- a/src/libstd/tuple.rs
+++ b/src/libstd/tuple.rs
@@ -12,6 +12,7 @@
 
 #[allow(missing_doc)];
 
+use clone::Clone;
 use kinds::Copy;
 use vec;
 use vec::ImmutableVector;
@@ -19,7 +20,7 @@ use iterator::IteratorUtil;
 
 pub use self::inner::*;
 
-/// Method extensions to pairs where both types satisfy the `Copy` bound
+/// Method extensions to pairs where both types satisfy the `Clone` bound
 pub trait CopyableTuple<T, U> {
     /// Return the first element of self
     fn first(&self) -> T;
@@ -29,12 +30,12 @@ pub trait CopyableTuple<T, U> {
     fn swap(&self) -> (U, T);
 }
 
-impl<T:Copy,U:Copy> CopyableTuple<T, U> for (T, U) {
+impl<T:Clone,U:Clone> CopyableTuple<T, U> for (T, U) {
     /// Return the first element of self
     #[inline]
     fn first(&self) -> T {
         match *self {
-            (ref t, _) => copy *t,
+            (ref t, _) => (*t).clone(),
         }
     }
 
@@ -42,21 +43,21 @@ impl<T:Copy,U:Copy> CopyableTuple<T, U> for (T, U) {
     #[inline]
     fn second(&self) -> U {
         match *self {
-            (_, ref u) => copy *u,
+            (_, ref u) => (*u).clone(),
         }
     }
 
     /// Return the results of swapping the two elements of self
     #[inline]
     fn swap(&self) -> (U, T) {
-        match copy *self {
+        match (*self).clone() {
             (t, u) => (u, t),
         }
     }
 }
 
 /// Method extensions for pairs where the types don't necessarily satisfy the
-/// `Copy` bound
+/// `Clone` bound
 pub trait ImmutableTuple<T, U> {
     /// Return a reference to the first element of self
     fn first_ref<'a>(&'a self) -> &'a T;
@@ -84,7 +85,11 @@ pub trait ExtendedTupleOps<A,B> {
     fn map<C>(&self, f: &fn(a: &A, b: &B) -> C) -> ~[C];
 }
 
-impl<'self,A:Copy,B:Copy> ExtendedTupleOps<A,B> for (&'self [A], &'self [B]) {
+impl<'self,
+     A:Copy + Clone,
+     B:Copy + Clone>
+     ExtendedTupleOps<A,B> for
+     (&'self [A], &'self [B]) {
     #[inline]
     fn zip(&self) -> ~[(A, B)] {
         match *self {
@@ -104,7 +109,10 @@ impl<'self,A:Copy,B:Copy> ExtendedTupleOps<A,B> for (&'self [A], &'self [B]) {
     }
 }
 
-impl<A:Copy,B:Copy> ExtendedTupleOps<A,B> for (~[A], ~[B]) {
+impl<A:Copy + Clone,
+     B:Copy + Clone>
+     ExtendedTupleOps<A,B> for
+     (~[A], ~[B]) {
     #[inline]
     fn zip(&self) -> ~[(A, B)] {
         match *self {