File tree 1 file changed +15
-6
lines changed
src/librustdoc/html/render
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -567,18 +567,27 @@ fn document_short<'a, 'cx: 'a>(
567
567
let ( mut summary_html, has_more_content) =
568
568
MarkdownSummaryLine ( & s, & item. links ( cx) ) . into_string_with_has_more_content ( ) ;
569
569
570
- if has_more_content {
571
- let link =
572
- format ! ( " <a{}>Read more</a>" , assoc_href_attr( item, link, cx) . maybe_display( ) ) ;
570
+ let link = if has_more_content {
571
+ let link = fmt:: from_fn ( |f| {
572
+ write ! (
573
+ f,
574
+ " <a{}>Read more</a>" ,
575
+ assoc_href_attr( item, link, cx) . maybe_display( )
576
+ )
577
+ } ) ;
573
578
574
579
if let Some ( idx) = summary_html. rfind ( "</p>" ) {
575
- summary_html. insert_str ( idx, & link) ;
580
+ summary_html. insert_str ( idx, & link. to_string ( ) ) ;
581
+ None
576
582
} else {
577
- summary_html . push_str ( & link) ;
583
+ Some ( link)
578
584
}
585
+ } else {
586
+ None
579
587
}
588
+ . maybe_display ( ) ;
580
589
581
- write ! ( f, "<div class='docblock'>{summary_html}</div>" ) ?;
590
+ write ! ( f, "<div class='docblock'>{summary_html}{link} </div>" ) ?;
582
591
}
583
592
Ok ( ( ) )
584
593
} )
You can’t perform that action at this time.
0 commit comments