rustdoc: Clarify construction of name for search index

This commit is contained in:
Noah Lev 2024-08-01 23:20:20 -07:00
parent 7dd5ad282c
commit 2721e97c5d

View File

@ -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)
}