Skip to content

Commit aee0eba

Browse files
committed
Remove redundant 'Type' in variant names, stop reexporting.
1 parent ab38d52 commit aee0eba

File tree

3 files changed

+47
-48
lines changed

3 files changed

+47
-48
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,49 +73,49 @@ fn try_inline_def<'a, 'tcx>(cx: &DocContext, tcx: TyCtxt<'a, 'tcx, 'tcx>,
7373
let did = def.def_id();
7474
let inner = match def {
7575
Def::Trait(did) => {
76-
record_extern_fqn(cx, did, clean::TypeTrait);
76+
record_extern_fqn(cx, did, clean::TypeKind::Trait);
7777
ret.extend(build_impls(cx, tcx, did));
7878
clean::TraitItem(build_external_trait(cx, tcx, did))
7979
}
8080
Def::Fn(did) => {
81-
record_extern_fqn(cx, did, clean::TypeFunction);
81+
record_extern_fqn(cx, did, clean::TypeKind::Function);
8282
clean::FunctionItem(build_external_function(cx, tcx, did))
8383
}
8484
Def::Struct(did)
8585
// If this is a struct constructor, we skip it
8686
if tcx.def_key(did).disambiguated_data.data != DefPathData::StructCtor => {
87-
record_extern_fqn(cx, did, clean::TypeStruct);
87+
record_extern_fqn(cx, did, clean::TypeKind::Struct);
8888
ret.extend(build_impls(cx, tcx, did));
8989
clean::StructItem(build_struct(cx, tcx, did))
9090
}
9191
Def::Union(did) => {
92-
record_extern_fqn(cx, did, clean::TypeUnion);
92+
record_extern_fqn(cx, did, clean::TypeKind::Union);
9393
ret.extend(build_impls(cx, tcx, did));
9494
clean::UnionItem(build_union(cx, tcx, did))
9595
}
9696
Def::TyAlias(did) => {
97-
record_extern_fqn(cx, did, clean::TypeTypedef);
97+
record_extern_fqn(cx, did, clean::TypeKind::Typedef);
9898
ret.extend(build_impls(cx, tcx, did));
9999
clean::TypedefItem(build_type_alias(cx, tcx, did), false)
100100
}
101101
Def::Enum(did) => {
102-
record_extern_fqn(cx, did, clean::TypeEnum);
102+
record_extern_fqn(cx, did, clean::TypeKind::Enum);
103103
ret.extend(build_impls(cx, tcx, did));
104104
clean::EnumItem(build_enum(cx, tcx, did))
105105
}
106106
// Assume that the enum type is reexported next to the variant, and
107107
// variants don't show up in documentation specially.
108108
Def::Variant(..) => return Some(Vec::new()),
109109
Def::Mod(did) => {
110-
record_extern_fqn(cx, did, clean::TypeModule);
110+
record_extern_fqn(cx, did, clean::TypeKind::Module);
111111
clean::ModuleItem(build_module(cx, tcx, did))
112112
}
113113
Def::Static(did, mtbl) => {
114-
record_extern_fqn(cx, did, clean::TypeStatic);
114+
record_extern_fqn(cx, did, clean::TypeKind::Static);
115115
clean::StaticItem(build_static(cx, tcx, did, mtbl))
116116
}
117117
Def::Const(did) | Def::AssociatedConst(did) => {
118-
record_extern_fqn(cx, did, clean::TypeConst);
118+
record_extern_fqn(cx, did, clean::TypeKind::Const);
119119
clean::ConstantItem(build_const(cx, tcx, did))
120120
}
121121
_ => return None,

src/librustdoc/clean/mod.rs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//! that clean them.
1313
1414
pub use self::Type::*;
15-
pub use self::TypeKind::*;
1615
pub use self::VariantKind::*;
1716
pub use self::Mutability::*;
1817
pub use self::Import::*;
@@ -688,7 +687,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
688687
(tcx.lang_items.sync_trait().unwrap(),
689688
external_path(cx, "Sync", None, false, vec![], empty)),
690689
};
691-
inline::record_extern_fqn(cx, did, TypeTrait);
690+
inline::record_extern_fqn(cx, did, TypeKind::Trait);
692691
TraitBound(PolyTrait {
693692
trait_: ResolvedPath {
694693
path: path,
@@ -707,7 +706,7 @@ impl<'tcx> Clean<TyParamBound> for ty::TraitRef<'tcx> {
707706
Some(tcx) => tcx,
708707
None => return RegionBound(Lifetime::statik())
709708
};
710-
inline::record_extern_fqn(cx, self.def_id, TypeTrait);
709+
inline::record_extern_fqn(cx, self.def_id, TypeKind::Trait);
711710
let path = external_path(cx, &tcx.item_name(self.def_id).as_str(),
712711
Some(self.def_id), true, vec![], self.substs);
713712

@@ -1480,16 +1479,16 @@ pub enum PrimitiveType {
14801479

14811480
#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)]
14821481
pub enum TypeKind {
1483-
TypeEnum,
1484-
TypeFunction,
1485-
TypeModule,
1486-
TypeConst,
1487-
TypeStatic,
1488-
TypeStruct,
1489-
TypeUnion,
1490-
TypeTrait,
1491-
TypeVariant,
1492-
TypeTypedef,
1482+
Enum,
1483+
Function,
1484+
Module,
1485+
Const,
1486+
Static,
1487+
Struct,
1488+
Union,
1489+
Trait,
1490+
Variant,
1491+
Typedef,
14931492
}
14941493

14951494
pub trait GetDefId {
@@ -1795,9 +1794,9 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
17951794
ty::TyAdt(def, substs) => {
17961795
let did = def.did;
17971796
let kind = match def.adt_kind() {
1798-
AdtKind::Struct => TypeStruct,
1799-
AdtKind::Union => TypeUnion,
1800-
AdtKind::Enum => TypeEnum,
1797+
AdtKind::Struct => TypeKind::Struct,
1798+
AdtKind::Union => TypeKind::Union,
1799+
AdtKind::Enum => TypeKind::Enum,
18011800
};
18021801
inline::record_extern_fqn(cx, did, kind);
18031802
let path = external_path(cx, &cx.tcx().item_name(did).as_str(),
@@ -1811,7 +1810,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
18111810
}
18121811
ty::TyTrait(ref obj) => {
18131812
let did = obj.principal.def_id();
1814-
inline::record_extern_fqn(cx, did, TypeTrait);
1813+
inline::record_extern_fqn(cx, did, TypeKind::Trait);
18151814

18161815
let mut typarams = vec![];
18171816
obj.region_bound.clean(cx).map(|b| typarams.push(RegionBound(b)));
@@ -2761,24 +2760,24 @@ fn register_def(cx: &DocContext, def: Def) -> DefId {
27612760
let tcx = cx.tcx();
27622761

27632762
let (did, kind) = match def {
2764-
Def::Fn(i) => (i, TypeFunction),
2765-
Def::TyAlias(i) => (i, TypeTypedef),
2766-
Def::Enum(i) => (i, TypeEnum),
2767-
Def::Trait(i) => (i, TypeTrait),
2768-
Def::Struct(i) => (i, TypeStruct),
2769-
Def::Union(i) => (i, TypeUnion),
2770-
Def::Mod(i) => (i, TypeModule),
2771-
Def::Static(i, _) => (i, TypeStatic),
2772-
Def::Variant(i) => (tcx.parent_def_id(i).unwrap(), TypeEnum),
2773-
Def::SelfTy(Some(def_id), _) => (def_id, TypeTrait),
2763+
Def::Fn(i) => (i, TypeKind::Function),
2764+
Def::TyAlias(i) => (i, TypeKind::Typedef),
2765+
Def::Enum(i) => (i, TypeKind::Enum),
2766+
Def::Trait(i) => (i, TypeKind::Trait),
2767+
Def::Struct(i) => (i, TypeKind::Struct),
2768+
Def::Union(i) => (i, TypeKind::Union),
2769+
Def::Mod(i) => (i, TypeKind::Module),
2770+
Def::Static(i, _) => (i, TypeKind::Static),
2771+
Def::Variant(i) => (tcx.parent_def_id(i).unwrap(), TypeKind::Enum),
2772+
Def::SelfTy(Some(def_id), _) => (def_id, TypeKind::Trait),
27742773
Def::SelfTy(_, Some(impl_def_id)) => {
27752774
return impl_def_id
27762775
}
27772776
_ => return def.def_id()
27782777
};
27792778
if did.is_local() { return did }
27802779
inline::record_extern_fqn(cx, did, kind);
2781-
if let TypeTrait = kind {
2780+
if let TypeKind::Trait = kind {
27822781
let t = inline::build_external_trait(cx, tcx, did);
27832782
cx.external_traits.borrow_mut().insert(did, t);
27842783
}
@@ -2966,7 +2965,7 @@ fn lang_struct(cx: &DocContext, did: Option<DefId>,
29662965
Some(did) => did,
29672966
None => return fallback(box t.clean(cx)),
29682967
};
2969-
inline::record_extern_fqn(cx, did, TypeStruct);
2968+
inline::record_extern_fqn(cx, did, TypeKind::Struct);
29702969
ResolvedPath {
29712970
typarams: None,
29722971
did: did,

src/librustdoc/html/item_type.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ impl<'a> From<&'a clean::Item> for ItemType {
9090
impl From<clean::TypeKind> for ItemType {
9191
fn from(kind: clean::TypeKind) -> ItemType {
9292
match kind {
93-
clean::TypeStruct => ItemType::Struct,
94-
clean::TypeUnion => ItemType::Union,
95-
clean::TypeEnum => ItemType::Enum,
96-
clean::TypeFunction => ItemType::Function,
97-
clean::TypeTrait => ItemType::Trait,
98-
clean::TypeModule => ItemType::Module,
99-
clean::TypeStatic => ItemType::Static,
100-
clean::TypeConst => ItemType::Constant,
101-
clean::TypeVariant => ItemType::Variant,
102-
clean::TypeTypedef => ItemType::Typedef,
93+
clean::TypeKind::Struct => ItemType::Struct,
94+
clean::TypeKind::Union => ItemType::Union,
95+
clean::TypeKind::Enum => ItemType::Enum,
96+
clean::TypeKind::Function => ItemType::Function,
97+
clean::TypeKind::Trait => ItemType::Trait,
98+
clean::TypeKind::Module => ItemType::Module,
99+
clean::TypeKind::Static => ItemType::Static,
100+
clean::TypeKind::Const => ItemType::Constant,
101+
clean::TypeKind::Variant => ItemType::Variant,
102+
clean::TypeKind::Typedef => ItemType::Typedef,
103103
}
104104
}
105105
}

0 commit comments

Comments
 (0)