Skip to content

Commit

Permalink
Remove redundant 'Import' in variant names, stop reexporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Oct 3, 2016
1 parent a400ccc commit 5b9ba4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -14,7 +14,6 @@
pub use self::Type::*;
pub use self::VariantKind::*;
pub use self::Mutability::*;
pub use self::Import::*;
pub use self::ItemEnum::*;
pub use self::Attribute::*;
pub use self::TyParamBound::*;
Expand Down Expand Up @@ -2527,7 +2526,7 @@ impl Clean<Vec<Item>> for doctree::Import {
});
let (mut ret, inner) = match self.node {
hir::ViewPathGlob(ref p) => {
(vec![], GlobImport(resolve_use_source(cx, p.clean(cx), self.id)))
(vec![], Import::Glob(resolve_use_source(cx, p.clean(cx), self.id)))
}
hir::ViewPathList(ref p, ref list) => {
// Attempt to inline all reexported items, but be sure
Expand All @@ -2553,17 +2552,17 @@ impl Clean<Vec<Item>> for doctree::Import {
if remaining.is_empty() {
return ret;
}
(ret, ImportList(resolve_use_source(cx, p.clean(cx), self.id),
remaining))
(ret, Import::List(resolve_use_source(cx, p.clean(cx), self.id),
remaining))
}
hir::ViewPathSimple(name, ref p) => {
if !denied {
if let Some(items) = inline::try_inline(cx, self.id, Some(name)) {
return items;
}
}
(vec![], SimpleImport(name.clean(cx),
resolve_use_source(cx, p.clean(cx), self.id)))
(vec![], Import::Simple(name.clean(cx),
resolve_use_source(cx, p.clean(cx), self.id)))
}
};
ret.push(Item {
Expand All @@ -2583,11 +2582,11 @@ impl Clean<Vec<Item>> for doctree::Import {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub enum Import {
// use source as str;
SimpleImport(String, ImportSource),
Simple(String, ImportSource),
// use source::*;
GlobImport(ImportSource),
Glob(ImportSource),
// use source::{a, b, c};
ImportList(ImportSource, Vec<ViewListIdent>),
List(ImportSource, Vec<ViewListIdent>),
}

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/format.rs
Expand Up @@ -708,17 +708,17 @@ impl fmt::Display for ConstnessSpace {
impl fmt::Display for clean::Import {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
clean::SimpleImport(ref name, ref src) => {
clean::Import::Simple(ref name, ref src) => {
if *name == src.path.last_name() {
write!(f, "use {};", *src)
} else {
write!(f, "use {} as {};", *src, *name)
}
}
clean::GlobImport(ref src) => {
clean::Import::Glob(ref src) => {
write!(f, "use {}::*;", *src)
}
clean::ImportList(ref src, ref names) => {
clean::Import::List(ref src, ref names) => {
write!(f, "use {}::{{", *src)?;
for (i, n) in names.iter().enumerate() {
if i > 0 {
Expand Down

0 comments on commit 5b9ba4c

Please sign in to comment.