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 @@ -569,18 +569,27 @@ fn document_short<'a, 'cx: 'a>(
569
569
let ( mut summary_html, has_more_content) =
570
570
MarkdownSummaryLine ( & s, & item. links ( cx) ) . into_string_with_has_more_content ( ) ;
571
571
572
- if has_more_content {
573
- let link =
574
- format ! ( " <a{}>Read more</a>" , assoc_href_attr( item, link, cx) . maybe_display( ) ) ;
572
+ let link = if has_more_content {
573
+ let link = fmt:: from_fn ( |f| {
574
+ write ! (
575
+ f,
576
+ " <a{}>Read more</a>" ,
577
+ assoc_href_attr( item, link, cx) . maybe_display( )
578
+ )
579
+ } ) ;
575
580
576
581
if let Some ( idx) = summary_html. rfind ( "</p>" ) {
577
- summary_html. insert_str ( idx, & link) ;
582
+ summary_html. insert_str ( idx, & link. to_string ( ) ) ;
583
+ None
578
584
} else {
579
- summary_html . push_str ( & link) ;
585
+ Some ( link)
580
586
}
587
+ } else {
588
+ None
581
589
}
590
+ . maybe_display ( ) ;
582
591
583
- write ! ( f, "<div class='docblock'>{summary_html}</div>" ) ?;
592
+ write ! ( f, "<div class='docblock'>{summary_html}{link} </div>" ) ?;
584
593
}
585
594
Ok ( ( ) )
586
595
} )
You can’t perform that action at this time.
0 commit comments