syntax: ViewItemUse no longer contains multiple view paths.

it reflected the obsolete syntax `use a, b, c;` and did not make
past the parser (though it was a non-fatal error so we can continue).
this legacy affected many portions of rustc and rustdoc as well,
so this commit cleans them up altogether.
This commit is contained in:
Kang Seonghoon 2014-04-26 22:33:45 +09:00
parent eea4909a87
commit b03547bac1
15 changed files with 185 additions and 208 deletions

View file

@ -1085,7 +1085,7 @@ impl Clean<Item> for ast::ViewItem {
#[deriving(Clone, Encodable, Decodable)]
pub enum ViewItemInner {
ExternCrate(~str, Option<~str>, ast::NodeId),
Import(Vec<ViewPath>)
Import(ViewPath)
}
impl Clean<ViewItemInner> for ast::ViewItem_ {
@ -1099,7 +1099,7 @@ impl Clean<ViewItemInner> for ast::ViewItem_ {
ExternCrate(i.clean(), string, *id)
}
&ast::ViewItemUse(ref vp) => {
Import(vp.clean().move_iter().collect())
Import(vp.clean())
}
}
}

View file

@ -1165,12 +1165,10 @@ fn item_module(w: &mut Writer, cx: &Context,
try!(write!(w, ";</code></td></tr>"));
}
clean::Import(ref imports) => {
for import in imports.iter() {
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
VisSpace(myitem.visibility),
*import));
}
clean::Import(ref import) => {
try!(write!(w, "<tr><td><code>{}{}</code></td></tr>",
VisSpace(myitem.visibility),
*import));
}
}

View file

@ -133,14 +133,12 @@ impl<'a> RustdocVisitor<'a> {
return om.view_items.push(item.clone());
}
let item = match item.node {
ast::ViewItemUse(ref paths) => {
// rustc no longer supports "use foo, bar;"
assert_eq!(paths.len(), 1);
match self.visit_view_path(*paths.get(0), om) {
ast::ViewItemUse(ref vpath) => {
match self.visit_view_path(*vpath, om) {
None => return,
Some(path) => {
ast::ViewItem {
node: ast::ViewItemUse(vec!(path)),
node: ast::ViewItemUse(path),
.. item.clone()
}
}