Skip to content

Commit 81a5b94

Browse files
formatting
1 parent fd4a88f commit 81a5b94

File tree

4 files changed

+28
-49
lines changed

4 files changed

+28
-49
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,9 @@ fn build_type_alias_type(cx: &DocContext<'_>, did: DefId) -> Option<clean::Type>
284284

285285
pub fn build_ty(cx: &DocContext, did: DefId) -> Option<clean::Type> {
286286
match cx.tcx.def_kind(did)? {
287-
DefKind::Struct |
288-
DefKind::Union |
289-
DefKind::Enum |
290-
DefKind::Const |
291-
DefKind::Static => Some(cx.tcx.type_of(did).clean(cx)),
287+
DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::Const | DefKind::Static => {
288+
Some(cx.tcx.type_of(did).clean(cx))
289+
}
292290
DefKind::TyAlias => build_type_alias_type(cx, did),
293291
_ => None,
294292
}

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,14 +1124,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
11241124
hir::ImplItemKind::TyAlias(ref ty) => {
11251125
let type_ = ty.clean(cx);
11261126
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
1127-
TypedefItem(
1128-
Typedef {
1129-
type_,
1130-
generics: Generics::default(),
1131-
item_type,
1132-
},
1133-
true,
1134-
)
1127+
TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
11351128
}
11361129
hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(
11371130
OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() },
@@ -2011,14 +2004,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
20112004
visibility: self.vis.clean(cx),
20122005
stability: cx.stability(self.id).clean(cx),
20132006
deprecation: cx.deprecation(self.id).clean(cx),
2014-
inner: TypedefItem(
2015-
Typedef {
2016-
type_,
2017-
generics: self.gen.clean(cx),
2018-
item_type,
2019-
},
2020-
false,
2021-
),
2007+
inner: TypedefItem(Typedef { type_, generics: self.gen.clean(cx), item_type }, false),
20222008
}
20232009
}
20242010
}

src/librustdoc/html/render.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3474,12 +3474,10 @@ fn render_deref_methods(
34743474
.items
34753475
.iter()
34763476
.filter_map(|item| match item.inner {
3477-
clean::TypedefItem(ref t, true) => {
3478-
Some(match *t {
3479-
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
3480-
_ => (&t.type_, &t.type_),
3481-
})
3482-
}
3477+
clean::TypedefItem(ref t, true) => Some(match *t {
3478+
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
3479+
_ => (&t.type_, &t.type_),
3480+
}),
34833481
_ => None,
34843482
})
34853483
.next()
@@ -4133,12 +4131,10 @@ fn sidebar_assoc_items(it: &clean::Item) -> String {
41334131
.items
41344132
.iter()
41354133
.filter_map(|item| match item.inner {
4136-
clean::TypedefItem(ref t, true) => {
4137-
Some(match *t {
4138-
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
4139-
_ => (&t.type_, &t.type_),
4140-
})
4141-
}
4134+
clean::TypedefItem(ref t, true) => Some(match *t {
4135+
clean::Typedef { item_type: Some(ref type_), .. } => (&t.type_, type_),
4136+
_ => (&t.type_, &t.type_),
4137+
}),
41424138
_ => None,
41434139
})
41444140
.next()

src/librustdoc/html/render/cache.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
574574
// has since been learned.
575575
for &(did, ref item) in orphan_impl_items {
576576
if let Some(&(ref fqp, _)) = paths.get(&did) {
577-
if item.name.is_none() { // this is most likely from a typedef
577+
if item.name.is_none() {
578+
// this is most likely from a typedef
578579
continue;
579580
}
580581
search_index.push(IndexItem {
@@ -596,22 +597,20 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
596597

597598
for item in search_index {
598599
item.parent_idx = match item.parent {
599-
Some(nodeid) => {
600-
Some(if nodeid_to_pathid.contains_key(&nodeid) {
601-
*nodeid_to_pathid.get(&nodeid).expect("no pathid")
602-
} else {
603-
let pathid = lastpathid;
604-
nodeid_to_pathid.insert(nodeid, pathid);
605-
lastpathid += 1;
600+
Some(nodeid) => Some(if nodeid_to_pathid.contains_key(&nodeid) {
601+
*nodeid_to_pathid.get(&nodeid).expect("no pathid")
602+
} else {
603+
let pathid = lastpathid;
604+
nodeid_to_pathid.insert(nodeid, pathid);
605+
lastpathid += 1;
606606

607-
if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
608-
crate_paths.push((short, fqp.last().expect("no fqp").clone()));
609-
} else {
610-
continue
611-
}
612-
pathid
613-
})
614-
}
607+
if let Some(&(ref fqp, short)) = paths.get(&nodeid) {
608+
crate_paths.push((short, fqp.last().expect("no fqp").clone()));
609+
} else {
610+
continue;
611+
}
612+
pathid
613+
}),
615614
None => None,
616615
};
617616

0 commit comments

Comments
 (0)