about summary refs log tree commit diff
path: root/src/libstd/to_bytes.rs
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2013-06-21 20:08:35 -0400
committerBen Blum <bblum@andrew.cmu.edu>2013-06-29 04:39:34 -0400
commitff4ab9e147b0be4126b8b70ca6ab27173a46077a (patch)
treef028c640cd8a3efd7f8ec5661ba255d269250dbe /src/libstd/to_bytes.rs
parent89110fdf55c000096fc24a78d35256544c7b523f (diff)
downloadrust-ff4ab9e147b0be4126b8b70ca6ab27173a46077a.tar.gz
rust-ff4ab9e147b0be4126b8b70ca6ab27173a46077a.zip
'Borrow' stack closures rather than copying them (e.g., "|x|f(x)"), in prep for making them noncopyable.
Diffstat (limited to 'src/libstd/to_bytes.rs')
-rw-r--r--src/libstd/to_bytes.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs
index 6f0c615d007..d6e92dd679e 100644
--- a/src/libstd/to_bytes.rs
+++ b/src/libstd/to_bytes.rs
@@ -232,7 +232,8 @@ impl<A:IterBytes,B:IterBytes> IterBytes for (A,B) {
   #[inline]
   fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
     match *self {
-      (ref a, ref b) => { a.iter_bytes(lsb0, f) && b.iter_bytes(lsb0, f) }
+      (ref a, ref b) => { a.iter_bytes(lsb0, |b| f(b)) &&
+                          b.iter_bytes(lsb0, |b| f(b)) }
     }
   }
 }
@@ -242,7 +243,9 @@ impl<A:IterBytes,B:IterBytes,C:IterBytes> IterBytes for (A,B,C) {
   fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
     match *self {
       (ref a, ref b, ref c) => {
-        a.iter_bytes(lsb0, f) && b.iter_bytes(lsb0, f) && c.iter_bytes(lsb0, f)
+        a.iter_bytes(lsb0, |b| f(b)) &&
+        b.iter_bytes(lsb0, |b| f(b)) &&
+        c.iter_bytes(lsb0, |b| f(b))
       }
     }
   }
@@ -296,7 +299,7 @@ impl<A:IterBytes> IterBytes for Option<A> {
     #[inline]
     fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
         match *self {
-          Some(ref a) => 0u8.iter_bytes(lsb0, f) && a.iter_bytes(lsb0, f),
+          Some(ref a) => 0u8.iter_bytes(lsb0, |b| f(b)) && a.iter_bytes(lsb0, |b| f(b)),
           None => 1u8.iter_bytes(lsb0, f)
         }
     }