diff options
| author | Ms2ger <ms2ger@gmail.com> | 2015-01-24 19:22:09 +0100 |
|---|---|---|
| committer | Ms2ger <ms2ger@gmail.com> | 2015-01-28 09:42:16 +0100 |
| commit | 4ad677e5b65b803e15e91e40097e2d77f0209ca7 (patch) | |
| tree | 7fedd7d35b3023d02d3fcb1f55d09f31712494f0 /src/libsyntax/ast_map | |
| parent | f88c94d8d2c74402d6f72607a47c4850dcdf3b4d (diff) | |
| download | rust-4ad677e5b65b803e15e91e40097e2d77f0209ca7.tar.gz rust-4ad677e5b65b803e15e91e40097e2d77f0209ca7.zip | |
Remove a custom variant of iter::Cloned.
Diffstat (limited to 'src/libsyntax/ast_map')
| -rw-r--r-- | src/libsyntax/ast_map/mod.rs | 19 |
1 files changed, 3 insertions, 16 deletions
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<T> { - 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<Values<'a, PathElem>, LinkedPath<'b>>; +pub type PathElems<'a, 'b> = iter::Chain<iter::Cloned<slice::Iter<'a, PathElem>>, LinkedPath<'b>>; pub fn path_to_string<PI: Iterator<Item=PathElem>>(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 { |
