1
Fork 0

remove unneeded code from cache.rs

This commit is contained in:
Guillaume Gomez 2020-01-15 13:56:11 +01:00
parent 81a5b94ac6
commit 6e791464bc

View file

@ -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(),
@ -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 {