Skip to content

Commit

Permalink
Auto merge of #27451 - seanmonstar:use-groups-as, r=alexcrichton
Browse files Browse the repository at this point in the history
An implementation of [RFC 1219](rust-lang/rfcs#1219).

The RFC is not merged yet, but once merged, this could be.
  • Loading branch information
bors committed Aug 10, 2015
2 parents 6d55f10 + a235508 commit 0ac7c88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ impl Clean<Vec<Item>> for doctree::Import {
let remaining = if !denied {
let mut remaining = vec![];
for path in list {
match inline::try_inline(cx, path.node.id(), None) {
match inline::try_inline(cx, path.node.id(), path.node.rename()) {
Some(items) => {
ret.extend(items);
}
Expand Down Expand Up @@ -2428,18 +2428,21 @@ pub struct ImportSource {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct ViewListIdent {
pub name: String,
pub rename: Option<String>,
pub source: Option<ast::DefId>,
}

impl Clean<ViewListIdent> for ast::PathListItem {
fn clean(&self, cx: &DocContext) -> ViewListIdent {
match self.node {
ast::PathListIdent { id, name } => ViewListIdent {
ast::PathListIdent { id, name, rename } => ViewListIdent {
name: name.clean(cx),
rename: rename.map(|r| r.clean(cx)),
source: resolve_def(cx, id)
},
ast::PathListMod { id } => ViewListIdent {
ast::PathListMod { id, rename } => ViewListIdent {
name: "self".to_string(),
rename: rename.map(|r| r.clean(cx)),
source: resolve_def(cx, id)
}
}
Expand Down
9 changes: 7 additions & 2 deletions html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,15 @@ impl fmt::Display for clean::ViewListIdent {
match self.source {
Some(did) => {
let path = clean::Path::singleton(self.name.clone());
resolved_path(f, did, &path, false)
try!(resolved_path(f, did, &path, false));
}
_ => write!(f, "{}", self.name),
_ => try!(write!(f, "{}", self.name)),
}

if let Some(ref name) = self.rename {
try!(write!(f, " as {}", name));
}
Ok(())
}
}

Expand Down

0 comments on commit 0ac7c88

Please sign in to comment.