Rollup merge of #35618 - jseyfried:ast_view_path_refactor, r=eddyb

Refactor `PathListItem`s

This refactors away variant `Mod` of `ast::PathListItemKind` and refactors the remaining variant `Ident` to a struct `ast::PathListItem_`.
This commit is contained in:
Jeffrey Seyfried
2016-08-28 10:31:15 +00:00
21 changed files with 82 additions and 192 deletions

View File

@@ -2879,26 +2879,13 @@ impl<'a> State<'a> {
try!(word(&mut self.s, "::{"));
}
try!(self.commasep(Inconsistent, &idents[..], |s, w| {
match w.node {
ast::PathListItemKind::Ident { name, rename, .. } => {
try!(s.print_ident(name));
if let Some(ident) = rename {
try!(space(&mut s.s));
try!(s.word_space("as"));
try!(s.print_ident(ident));
}
Ok(())
},
ast::PathListItemKind::Mod { rename, .. } => {
try!(word(&mut s.s, "self"));
if let Some(ident) = rename {
try!(space(&mut s.s));
try!(s.word_space("as"));
try!(s.print_ident(ident));
}
Ok(())
}
try!(s.print_ident(w.node.name));
if let Some(ident) = w.node.rename {
try!(space(&mut s.s));
try!(s.word_space("as"));
try!(s.print_ident(ident));
}
Ok(())
}));
word(&mut self.s, "}")
}