diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-15 13:56:11 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-01-15 15:07:35 +0100 |
| commit | 6e791464bcabc3d64b8fd5de6f2217c67d81a8b1 (patch) | |
| tree | f18868af3f0ba9895f7e7e23d284b49a8f74e4a8 /src/librustdoc/html | |
| parent | 81a5b94ac60cc1a9c8d365d8c6166c148279276c (diff) | |
| download | rust-6e791464bcabc3d64b8fd5de6f2217c67d81a8b1.tar.gz rust-6e791464bcabc3d64b8fd5de6f2217c67d81a8b1.zip | |
remove unneeded code from cache.rs
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/cache.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index fd9c47d0c4a..f1f83acdda5 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -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 { |
