diff options
| author | bors <bors@rust-lang.org> | 2015-01-29 11:28:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-29 11:28:30 +0000 |
| commit | 3d6f5100aff24aa97275dc92ade728caac605560 (patch) | |
| tree | 46d24003505b7ac308de9b4d4130b73825379b64 /src/libsyntax/ast_map | |
| parent | bedd8108dc9b79402d1ea5349d766275f73398ff (diff) | |
| parent | 092330c6405c275f89fbbbb412e932dd7ed8513d (diff) | |
| download | rust-3d6f5100aff24aa97275dc92ade728caac605560.tar.gz rust-3d6f5100aff24aa97275dc92ade728caac605560.zip | |
Auto merge of #21730 - Manishearth:rollup, r=alexcrichton
Should clear our backlog of rollups from the queue
Diffstat (limited to 'src/libsyntax/ast_map')
| -rw-r--r-- | src/libsyntax/ast_map/mod.rs | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index 96476cabac5..002e003afcb 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(); @@ -101,7 +88,7 @@ pub fn path_to_string<PI: Iterator<Item=PathElem>>(path: PI) -> String { } s.push_str(&e[]); s - }).to_string() + }) } #[derive(Copy, Show)] @@ -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 { |
