Skip to content

Commit 6e79146

Browse files
remove unneeded code from cache.rs
1 parent 81a5b94 commit 6e79146

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/librustdoc/html/render/cache.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,6 @@ 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() {
578-
// this is most likely from a typedef
579-
continue;
580-
}
581577
search_index.push(IndexItem {
582578
ty: item.type_(),
583579
name: item.name.clone().unwrap(),
@@ -596,23 +592,19 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
596592
let mut lastpathid = 0usize;
597593

598594
for item in search_index {
599-
item.parent_idx = match item.parent {
600-
Some(nodeid) => Some(if nodeid_to_pathid.contains_key(&nodeid) {
595+
item.parent_idx = item.parent.map(|nodeid| {
596+
if nodeid_to_pathid.contains_key(&nodeid) {
601597
*nodeid_to_pathid.get(&nodeid).expect("no pathid")
602598
} else {
603599
let pathid = lastpathid;
604600
nodeid_to_pathid.insert(nodeid, pathid);
605601
lastpathid += 1;
606602

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-
}
603+
let &(ref fqp, short) = paths.get(&nodeid).unwrap();
604+
crate_paths.push((short, fqp.last().unwrap().clone()));
612605
pathid
613-
}),
614-
None => None,
615-
};
606+
}
607+
});
616608

617609
// Omit the parent path if it is same to that of the prior item.
618610
if lastpath == item.path {

0 commit comments

Comments
 (0)