From 4ad677e5b65b803e15e91e40097e2d77f0209ca7 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 24 Jan 2015 19:22:09 +0100 Subject: Remove a custom variant of iter::Cloned. --- src/libsyntax/ast_map/mod.rs | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 96476cabac5..f2be6b22582 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -75,21 +75,8 @@ impl<'a> Iterator for LinkedPath<'a> { } } -// HACK(eddyb) move this into libstd (value wrapper for slice::Iter). -#[derive(Clone)] -pub struct Values<'a, T:'a>(pub slice::Iter<'a, T>); - -impl<'a, T: Copy> Iterator for Values<'a, T> { - type Item = T; - - fn next(&mut self) -> Option { - let &mut Values(ref mut items) = self; - items.next().map(|&x| x) - } -} - /// The type of the iterator used by with_path. -pub type PathElems<'a, 'b> = iter::Chain, LinkedPath<'b>>; +pub type PathElems<'a, 'b> = iter::Chain>, LinkedPath<'b>>; pub fn path_to_string>(path: PI) -> String { let itr = token::get_ident_interner(); @@ -458,9 +445,9 @@ impl<'ast> Map<'ast> { if parent == id { match self.find_entry(id) { Some(RootInlinedParent(data)) => { - f(Values(data.path.iter()).chain(next)) + f(data.path.iter().cloned().chain(next)) } - _ => f(Values([].iter()).chain(next)) + _ => f([].iter().cloned().chain(next)) } } else { self.with_path_next(parent, Some(&LinkedPathNode { -- cgit 1.4.1-3-g733a5