about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-05-29 19:59:33 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-05-30 15:20:36 -0400
commit7a1a40890d48321c69f66bd07e3a23d5d5ab939a (patch)
tree54eb8701f89acc95b05a2de5cfcd5c9be2742a3d /src/libstd
parent5209709e46ecfac2fd4db527952fe7ef96400801 (diff)
downloadrust-7a1a40890d48321c69f66bd07e3a23d5d5ab939a.tar.gz
rust-7a1a40890d48321c69f66bd07e3a23d5d5ab939a.zip
Remove copy bindings from patterns.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io.rs6
-rw-r--r--src/libstd/option.rs6
-rw-r--r--src/libstd/path.rs8
-rw-r--r--src/libstd/result.rs26
4 files changed, 23 insertions, 23 deletions
diff --git a/src/libstd/io.rs b/src/libstd/io.rs
index 011c56ac7c1..bfe82a015cd 100644
--- a/src/libstd/io.rs
+++ b/src/libstd/io.rs
@@ -1933,7 +1933,7 @@ mod tests {
     #[test]
     fn file_reader_not_exist() {
         match io::file_reader(&Path("not a file")) {
-          result::Err(copy e) => {
+          result::Err(e) => {
             assert_eq!(e, ~"error opening not a file");
           }
           result::Ok(_) => fail!()
@@ -1974,7 +1974,7 @@ mod tests {
     #[test]
     fn file_writer_bad_name() {
         match io::file_writer(&Path("?/?"), []) {
-          result::Err(copy e) => {
+          result::Err(e) => {
             assert!(str::starts_with(e, "error opening"));
           }
           result::Ok(_) => fail!()
@@ -1984,7 +1984,7 @@ mod tests {
     #[test]
     fn buffered_file_writer_bad_name() {
         match io::buffered_file_writer(&Path("?/?")) {
-          result::Err(copy e) => {
+          result::Err(e) => {
             assert!(str::starts_with(e, "error opening"));
           }
           result::Ok(_) => fail!()
diff --git a/src/libstd/option.rs b/src/libstd/option.rs
index be6ec8c8518..ee6e37aeb78 100644
--- a/src/libstd/option.rs
+++ b/src/libstd/option.rs
@@ -341,7 +341,7 @@ pub impl<T:Copy> Option<T> {
     #[inline(always)]
     fn get(self) -> T {
         match self {
-          Some(copy x) => return x,
+          Some(x) => return x,
           None => fail!("option::get none")
         }
     }
@@ -349,7 +349,7 @@ pub impl<T:Copy> Option<T> {
     /// Returns the contained value or a default
     #[inline(always)]
     fn get_or_default(self, def: T) -> T {
-        match self { Some(copy x) => x, None => def }
+        match self { Some(x) => x, None => def }
     }
 
     /// Applies a function zero or more times until the result is none.
@@ -366,7 +366,7 @@ pub impl<T:Copy + Zero> Option<T> {
     /// Returns the contained value or zero (for this type)
     #[inline(always)]
     fn get_or_zero(self) -> T {
-        match self { Some(copy x) => x, None => Zero::zero() }
+        match self { Some(x) => x, None => Zero::zero() }
     }
 }
 
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 39bd57b3c37..9eb7b54f009 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -774,9 +774,9 @@ impl GenericPath for WindowsPath {
 
         /* if rhs has a host set, then the whole thing wins */
         match other.host {
-            Some(copy host) => {
+            Some(ref host) => {
                 return WindowsPath {
-                    host: Some(host),
+                    host: Some(copy *host),
                     device: copy other.device,
                     is_absolute: true,
                     components: copy other.components,
@@ -787,10 +787,10 @@ impl GenericPath for WindowsPath {
 
         /* if rhs has a device set, then a part wins */
         match other.device {
-            Some(copy device) => {
+            Some(ref device) => {
                 return WindowsPath {
                     host: None,
-                    device: Some(device),
+                    device: Some(copy *device),
                     is_absolute: true,
                     components: copy other.components,
                 };
diff --git a/src/libstd/result.rs b/src/libstd/result.rs
index 4fe92ddb7b6..5b40b09e98e 100644
--- a/src/libstd/result.rs
+++ b/src/libstd/result.rs
@@ -40,7 +40,7 @@ pub enum Result<T, U> {
 #[inline(always)]
 pub fn get<T:Copy,U>(res: &Result<T, U>) -> T {
     match *res {
-      Ok(copy t) => t,
+      Ok(ref t) => copy *t,
       Err(ref the_err) =>
         fail!("get called on error result: %?", *the_err)
     }
@@ -72,7 +72,7 @@ pub fn get_ref<'a, T, U>(res: &'a Result<T, U>) -> &'a T {
 #[inline(always)]
 pub fn get_err<T, U: Copy>(res: &Result<T, U>) -> U {
     match *res {
-      Err(copy u) => u,
+      Err(ref u) => copy *u,
       Ok(_) => fail!("get_err called on ok result")
     }
 }
@@ -102,8 +102,8 @@ pub fn is_err<T, U>(res: &Result<T, U>) -> bool {
 pub fn to_either<T:Copy,U:Copy>(res: &Result<U, T>)
     -> Either<T, U> {
     match *res {
-      Ok(copy res) => either::Right(res),
-      Err(copy fail_) => either::Left(fail_)
+      Ok(ref res) => either::Right(copy *res),
+      Err(ref fail_) => either::Left(copy *fail_)
     }
 }
 
@@ -206,7 +206,7 @@ pub fn map<T, E: Copy, U: Copy>(res: &Result<T, E>, op: &fn(&T) -> U)
   -> Result<U, E> {
     match *res {
       Ok(ref t) => Ok(op(t)),
-      Err(copy e) => Err(e)
+      Err(ref e) => Err(copy *e)
     }
 }
 
@@ -222,7 +222,7 @@ pub fn map<T, E: Copy, U: Copy>(res: &Result<T, E>, op: &fn(&T) -> U)
 pub fn map_err<T:Copy,E,F:Copy>(res: &Result<T, E>, op: &fn(&E) -> F)
   -> Result<T, F> {
     match *res {
-      Ok(copy t) => Ok(t),
+      Ok(ref t) => Ok(copy *t),
       Err(ref e) => Err(op(e))
     }
 }
@@ -304,8 +304,8 @@ pub fn map_vec<T,U:Copy,V:Copy>(
     let mut vs: ~[V] = vec::with_capacity(vec::len(ts));
     for ts.each |t| {
         match op(t) {
-          Ok(copy v) => vs.push(v),
-          Err(copy u) => return Err(u)
+          Ok(v) => vs.push(v),
+          Err(u) => return Err(u)
         }
     }
     return Ok(vs);
@@ -319,8 +319,8 @@ pub fn map_opt<T,U:Copy,V:Copy>(
     match *o_t {
       None => Ok(None),
       Some(ref t) => match op(t) {
-        Ok(copy v) => Ok(Some(v)),
-        Err(copy e) => Err(e)
+        Ok(v) => Ok(Some(v)),
+        Err(e) => Err(e)
       }
     }
 }
@@ -344,8 +344,8 @@ pub fn map_vec2<S,T,U:Copy,V:Copy>(ss: &[S], ts: &[T],
     let mut i = 0u;
     while i < n {
         match op(&ss[i],&ts[i]) {
-          Ok(copy v) => vs.push(v),
-          Err(copy u) => return Err(u)
+          Ok(v) => vs.push(v),
+          Err(u) => return Err(u)
         }
         i += 1u;
     }
@@ -367,7 +367,7 @@ pub fn iter_vec2<S,T,U:Copy>(ss: &[S], ts: &[T],
     while i < n {
         match op(&ss[i],&ts[i]) {
           Ok(()) => (),
-          Err(copy u) => return Err(u)
+          Err(u) => return Err(u)
         }
         i += 1u;
     }