Make rustdoc display extern crate statements correctly

This commit is contained in:
P1start 2014-11-22 19:07:54 +13:00
parent 2f0249b3a8
commit 6b5655cb84
2 changed files with 8 additions and 6 deletions

View file

@ -1923,7 +1923,7 @@ impl Clean<ViewItemInner> for ast::ViewItem_ {
#[deriving(Clone, Encodable, Decodable)] #[deriving(Clone, Encodable, Decodable)]
pub enum ViewPath { pub enum ViewPath {
// use str = source; // use source as str;
SimpleImport(String, ImportSource), SimpleImport(String, ImportSource),
// use source::*; // use source::*;
GlobImport(ImportSource), GlobImport(ImportSource),

View file

@ -1582,12 +1582,14 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
clean::ViewItemItem(ref item) => { clean::ViewItemItem(ref item) => {
match item.inner { match item.inner {
clean::ExternCrate(ref name, ref src, _) => { clean::ExternCrate(ref name, ref src, _) => {
try!(write!(w, "<tr><td><code>extern crate {}",
name.as_slice()));
match *src { match *src {
Some(ref src) => try!(write!(w, " = \"{}\"", Some(ref src) =>
src.as_slice())), try!(write!(w, "<tr><td><code>extern crate \"{}\" as {}",
None => {} src.as_slice(),
name.as_slice())),
None =>
try!(write!(w, "<tr><td><code>extern crate {}",
name.as_slice())),
} }
try!(write!(w, ";</code></td></tr>")); try!(write!(w, ";</code></td></tr>"));
} }