about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-07-30 02:52:01 +0200
committerblake2-ppc <blake2-ppc>2013-07-30 02:52:01 +0200
commit99490ad5ba61b2ee69c2cdd70c70857eaf0b895f (patch)
tree304e61473a12f05f2def76160068ba68b579442e /src/libstd
parentae09d95160919f8801caa22e2867e9680e6cb05b (diff)
downloadrust-99490ad5ba61b2ee69c2cdd70c70857eaf0b895f.tar.gz
rust-99490ad5ba61b2ee69c2cdd70c70857eaf0b895f.zip
std: Remove macro in vec that's only used once
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/vec.rs29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index ca752490faa..cfd28fcfc5e 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -2135,23 +2135,19 @@ macro_rules! double_ended_iterator {
     }
 }
 
-macro_rules! random_access_iterator {
-    (impl $name:ident -> $elem:ty) => {
-        impl<'self, T> RandomAccessIterator<$elem> for $name<'self, T> {
-            #[inline]
-            fn indexable(&self) -> uint {
-                let (exact, _) = self.size_hint();
-                exact
-            }
+impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> {
+    #[inline]
+    fn indexable(&self) -> uint {
+        let (exact, _) = self.size_hint();
+        exact
+    }
 
-            fn idx(&self, index: uint) -> Option<$elem> {
-                unsafe {
-                    if index < self.indexable() {
-                        cast::transmute(self.ptr.offset(index))
-                    } else {
-                        None
-                    }
-                }
+    fn idx(&self, index: uint) -> Option<&'self T> {
+        unsafe {
+            if index < self.indexable() {
+                cast::transmute(self.ptr.offset(index))
+            } else {
+                None
             }
         }
     }
@@ -2166,7 +2162,6 @@ pub struct VecIterator<'self, T> {
 }
 iterator!{impl VecIterator -> &'self T}
 double_ended_iterator!{impl VecIterator -> &'self T}
-random_access_iterator!{impl VecIterator -> &'self T}
 pub type RevIterator<'self, T> = Invert<VecIterator<'self, T>>;
 
 impl<'self, T> Clone for VecIterator<'self, T> {