Skip to content

Commit 4bc5507

Browse files
committed
Auto merge of #31602 - mitaa:rdoc_doc_shorter, r=alexcrichton
fixes #25787 fixes #30366 r? @alexcrichton
2 parents e83b366 + 2260eef commit 4bc5507

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

html/render.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,8 @@ fn shorter<'a>(s: Option<&'a str>) -> String {
16531653

16541654
#[inline]
16551655
fn plain_summary_line(s: Option<&str>) -> String {
1656-
let line = shorter(s).replace("\n", " ");
1657-
markdown::plain_summary_line(&line[..])
1656+
let md = markdown::plain_summary_line(s.unwrap_or(""));
1657+
shorter(Some(&md)).replace("\n", " ")
16581658
}
16591659

16601660
fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result {
@@ -1781,6 +1781,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17811781
} else {
17821782
String::new()
17831783
};
1784+
let doc_value = myitem.doc_value().unwrap_or("");
17841785
try!(write!(w, "
17851786
<tr class='{stab} module-item'>
17861787
<td><a class='{class}' href='{href}'
@@ -1792,7 +1793,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
17921793
",
17931794
name = *myitem.name.as_ref().unwrap(),
17941795
stab_docs = stab_docs,
1795-
docs = Markdown(&shorter(myitem.doc_value())),
1796+
docs = shorter(Some(&Markdown(doc_value).to_string())),
17961797
class = shortty(myitem),
17971798
stab = myitem.stability_class(),
17981799
href = item_path(myitem),

0 commit comments

Comments
 (0)