std: Remove macro in vec that's only used once

This commit is contained in:
blake2-ppc 2013-07-30 02:52:01 +02:00
parent ae09d95160
commit 99490ad5ba

View File

@ -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> {