about summary refs log tree commit diff
path: root/src/librustdoc/html/render/search_index.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-25 14:00:31 +0000
committerbors <bors@rust-lang.org>2023-05-25 14:00:31 +0000
commitcade26637fe1c23965ce644299ed5200db7c92dd (patch)
tree0251882211c619ae6a83329cf890e8b5d02a2520 /src/librustdoc/html/render/search_index.rs
parentd300bffa4f0036e9138ef752610d08fc63f87a77 (diff)
parent4082053b007f5d318adbac8424d3641cd3ce80f9 (diff)
downloadrust-cade26637fe1c23965ce644299ed5200db7c92dd.tar.gz
rust-cade26637fe1c23965ce644299ed5200db7c92dd.zip
Auto merge of #111512 - petrochenkov:microdoc2, r=GuillaumeGomez
rustdoc: Cleanup doc string collapsing

`doc_value` and (former) `collapsed_doc_value` can be implemented in terms of each other, and `doc_value` doesn't need the `Option`.

This PR doesn't do any semantic changes, only refactoring, although some pre-existing choices between `doc_value` and `collapsed_doc_value` across rustdoc may be questionable.
Diffstat (limited to 'src/librustdoc/html/render/search_index.rs')
-rw-r--r--src/librustdoc/html/render/search_index.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs
index a3be6dd5269..846299f02e3 100644
--- a/src/librustdoc/html/render/search_index.rs
+++ b/src/librustdoc/html/render/search_index.rs
@@ -28,9 +28,7 @@ pub(crate) fn build_index<'tcx>(
     // has since been learned.
     for &OrphanImplItem { parent, ref item, ref impl_generics } in &cache.orphan_impl_items {
         if let Some((fqp, _)) = cache.paths.get(&parent) {
-            let desc = item
-                .doc_value()
-                .map_or_else(String::new, |s| short_markdown_summary(&s, &item.link_names(cache)));
+            let desc = short_markdown_summary(&item.doc_value(), &item.link_names(cache));
             cache.search_index.push(IndexItem {
                 ty: item.type_(),
                 name: item.name.unwrap(),
@@ -45,10 +43,8 @@ pub(crate) fn build_index<'tcx>(
         }
     }
 
-    let crate_doc = krate
-        .module
-        .doc_value()
-        .map_or_else(String::new, |s| short_markdown_summary(&s, &krate.module.link_names(cache)));
+    let crate_doc =
+        short_markdown_summary(&krate.module.doc_value(), &krate.module.link_names(cache));
 
     // Aliases added through `#[doc(alias = "...")]`. Since a few items can have the same alias,
     // we need the alias element to have an array of items.