formatting
This commit is contained in:
@@ -284,11 +284,9 @@ fn build_type_alias_type(cx: &DocContext<'_>, did: DefId) -> Option<clean::Type>
|
|||||||
|
|
||||||
pub fn build_ty(cx: &DocContext, did: DefId) -> Option<clean::Type> {
|
pub fn build_ty(cx: &DocContext, did: DefId) -> Option<clean::Type> {
|
||||||
match cx.tcx.def_kind(did)? {
|
match cx.tcx.def_kind(did)? {
|
||||||
DefKind::Struct |
|
DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::Const | DefKind::Static => {
|
||||||
DefKind::Union |
|
Some(cx.tcx.type_of(did).clean(cx))
|
||||||
DefKind::Enum |
|
}
|
||||||
DefKind::Const |
|
|
||||||
DefKind::Static => Some(cx.tcx.type_of(did).clean(cx)),
|
|
||||||
DefKind::TyAlias => build_type_alias_type(cx, did),
|
DefKind::TyAlias => build_type_alias_type(cx, did),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1124,14 +1124,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
|
|||||||
hir::ImplItemKind::TyAlias(ref ty) => {
|
hir::ImplItemKind::TyAlias(ref ty) => {
|
||||||
let type_ = ty.clean(cx);
|
let type_ = ty.clean(cx);
|
||||||
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
|
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
|
||||||
TypedefItem(
|
TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
|
||||||
Typedef {
|
|
||||||
type_,
|
|
||||||
generics: Generics::default(),
|
|
||||||
item_type,
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(
|
hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(
|
||||||
OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() },
|
OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() },
|
||||||
@@ -2011,14 +2004,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
|
|||||||
visibility: self.vis.clean(cx),
|
visibility: self.vis.clean(cx),
|
||||||
stability: cx.stability(self.id).clean(cx),
|
stability: cx.stability(self.id).clean(cx),
|
||||||
deprecation: cx.deprecation(self.id).clean(cx),
|
deprecation: cx.deprecation(self.id).clean(cx),
|
||||||
inner: TypedefItem(
|
inner: TypedefItem(Typedef { type_, generics: self.gen.clean(cx), item_type }, false),
|
||||||
Typedef {
|
|
||||||
type_,
|
|
||||||
generics: self.gen.clean(cx),
|
|
||||||
item_type,
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3474,12 +3474,10 @@ fn render_deref_methods(
|
|||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item.inner {
|
.filter_map(|item| match item.inner {
|
||||||
clean::TypedefItem(ref t, true) => {
|
clean::TypedefItem(ref t, true) => Some(match *t {
|
||||||
Some(match *t {
|
|
||||||
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
|
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
|
||||||
_ => (&t.type_, &t.type_),
|
_ => (&t.type_, &t.type_),
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.next()
|
.next()
|
||||||
@@ -4133,12 +4131,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
|
|||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item.inner {
|
.filter_map(|item| match item.inner {
|
||||||
clean::TypedefItem(ref t, true) => {
|
clean::TypedefItem(ref t, true) => Some(match *t {
|
||||||
Some(match *t {
|
|
||||||
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
|
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
|
||||||
_ => (&t.type_, &t.type_),
|
_ => (&t.type_, &t.type_),
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.next()
|
.next()
|
||||||
|
|||||||
@@ -574,7 +574,8 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
|
|||||||
// has since been learned.
|
// has since been learned.
|
||||||
for &(did, ref item) in orphan_impl_items {
|
for &(did, ref item) in orphan_impl_items {
|
||||||
if let Some(&(ref fqp, _)) = paths.get(&did) {
|
if let Some(&(ref fqp, _)) = paths.get(&did) {
|
||||||
if item.name.is_none() { // this is most likely from a typedef
|
if item.name.is_none() {
|
||||||
|
// this is most likely from a typedef
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
search_index.push(IndexItem {
|
search_index.push(IndexItem {
|
||||||
@@ -596,8 +597,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
|
|||||||
|
|
||||||
for item in search_index {
|
for item in search_index {
|
||||||
item.parent_idx = match item.parent {
|
item.parent_idx = match item.parent {
|
||||||
Some(nodeid) => {
|
Some(nodeid) => Some(if nodeid_to_pathid.contains_key(&nodeid) {
|
||||||
Some(if nodeid_to_pathid.contains_key(&nodeid) {
|
|
||||||
*nodeid_to_pathid.get(&nodeid).expect("no pathid")
|
*nodeid_to_pathid.get(&nodeid).expect("no pathid")
|
||||||
} else {
|
} else {
|
||||||
let pathid = lastpathid;
|
let pathid = lastpathid;
|
||||||
@@ -607,11 +607,10 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
|
|||||||
if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
|
if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
|
||||||
crate_paths.push((short, fqp.last().expect("no fqp").clone()));
|
crate_paths.push((short, fqp.last().expect("no fqp").clone()));
|
||||||
} else {
|
} else {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
pathid
|
pathid
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user