AST/HIR: Clarify what the optional name in extern crate items mean

This commit is contained in:
Vadim Petrochenkov
2018-03-09 18:51:48 +03:00
parent 61b6bf54fd
commit c6c6cf9515
16 changed files with 42 additions and 58 deletions

View File

@@ -1174,15 +1174,10 @@ impl<'a> State<'a> {
self.print_outer_attributes(&item.attrs)?;
self.ann.pre(self, NodeItem(item))?;
match item.node {
ast::ItemKind::ExternCrate(ref optional_path) => {
ast::ItemKind::ExternCrate(orig_name) => {
self.head(&visibility_qualified(&item.vis, "extern crate"))?;
if let Some(p) = *optional_path {
let val = p.as_str();
if val.contains('-') {
self.print_string(&val, ast::StrStyle::Cooked)?;
} else {
self.print_name(p)?;
}
if let Some(orig_name) = orig_name {
self.print_name(orig_name)?;
self.s.space()?;
self.s.word("as")?;
self.s.space()?;