Skip to content

Commit

Permalink
remove unneeded code from cache.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 15, 2020
1 parent 81a5b94 commit 6e79146
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/librustdoc/html/render/cache.rs
Expand Up @@ -574,10 +574,6 @@ 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
continue;
}
search_index.push(IndexItem {
ty: item.type_(),
name: item.name.clone().unwrap(),
Expand All @@ -596,23 +592,19 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
let mut lastpathid = 0usize;

for item in search_index {
item.parent_idx = match item.parent {
Some(nodeid) => Some(if nodeid_to_pathid.contains_key(&nodeid) {
item.parent_idx = item.parent.map(|nodeid| {
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;
}
let &(ref fqp, short) = paths.get(&nodeid).unwrap();
crate_paths.push((short, fqp.last().unwrap().clone()));
pathid
}),
None => None,
};
}
});

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

0 comments on commit 6e79146

Please sign in to comment.