File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -138,15 +138,13 @@ pub fn docs_from_attrs(attrs: &hir::Attrs) -> Option<String> {
138
138
for doc in docs {
139
139
// str::lines doesn't yield anything for the empty string
140
140
if !doc. is_empty ( ) {
141
- buf. extend ( Itertools :: intersperse (
142
- doc. lines ( ) . map ( |line| {
143
- line. char_indices ( )
144
- . nth ( indent)
145
- . map_or ( line, |( offset, _) | & line[ offset..] )
146
- . trim_end ( )
147
- } ) ,
148
- "\n " ,
149
- ) ) ;
141
+ // We don't trim trailing whitespace from doc comments as multiple trailing spaces
142
+ // indicates a hard line break in Markdown.
143
+ let lines = doc. lines ( ) . map ( |line| {
144
+ line. char_indices ( ) . nth ( indent) . map_or ( line, |( offset, _) | & line[ offset..] )
145
+ } ) ;
146
+
147
+ buf. extend ( Itertools :: intersperse ( lines, "\n " ) ) ;
150
148
}
151
149
buf. push ( '\n' ) ;
152
150
}
You can’t perform that action at this time.
0 commit comments