about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-12-16 14:51:48 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-12-16 14:52:35 +0100
commit14b508fbec6d9fdebda3397b0df908d829bbdb0b (patch)
tree2e653c74053780f3be2234cce3a16acaf476c249 /src/librustdoc/html/render
parent984eab57f708e62c09b3d708033fe620130b5f39 (diff)
downloadrust-14b508fbec6d9fdebda3397b0df908d829bbdb0b.tar.gz
rust-14b508fbec6d9fdebda3397b0df908d829bbdb0b.zip
Don't add "Read more" link if there is no extra content
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 80fbe9c1f06..146e5010e4e 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -467,9 +467,10 @@ fn document_short(
         return;
     }
     if let Some(s) = item.doc_value() {
-        let mut summary_html = MarkdownSummaryLine(&s, &item.links(cx)).into_string();
+        let (mut summary_html, has_more_content) =
+            MarkdownSummaryLine(&s, &item.links(cx)).into_string_with_has_more_content();
 
-        if s.contains('\n') {
+        if has_more_content {
             let link = format!(r#" <a{}>Read more</a>"#, assoc_href_attr(item, link, cx));
 
             if let Some(idx) = summary_html.rfind("</p>") {