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