diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2024-08-01 23:20:20 -0700 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2024-08-02 17:59:52 -0700 |
| commit | 2721e97c5d9a4e5a001461e499a751e81e10df4c (patch) | |
| tree | 26e3a4a894d8b3a7e5d8e7dd95d712b0c228af98 | |
| parent | 7dd5ad282c4aab165236c8ba9404929d7dd337ac (diff) | |
| download | rust-2721e97c5d9a4e5a001461e499a751e81e10df4c.tar.gz rust-2721e97c5d9a4e5a001461e499a751e81e10df4c.zip | |
rustdoc: Clarify construction of name for search index
| -rw-r--r-- | src/librustdoc/formats/cache.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 8c0ed6cddf0..13b91f483eb 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -260,17 +260,20 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { } // Index this method for searching later on. - if let Some(name) = item.name.or_else(|| { - if item.is_stripped() { - None - } else if let clean::ImportItem(ref i) = *item.kind - && let clean::ImportKind::Simple(s) = i.kind - { - Some(s) - } else { - None - } - }) { + let search_name = if !item.is_stripped() { + item.name.or_else(|| { + if let clean::ImportItem(ref i) = *item.kind + && let clean::ImportKind::Simple(s) = i.kind + { + Some(s) + } else { + None + } + }) + } else { + None + }; + if let Some(name) = search_name { add_item_to_search_index(self.tcx, &mut self.cache, &item, name) } |
