File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -306,15 +306,17 @@ fn merge_attrs(
306306 attrs : Attrs < ' _ > ,
307307 other_attrs : Option < Attrs < ' _ > > ,
308308) -> clean:: Attributes {
309- let mut merged_attrs: Vec < ast:: Attribute > = Vec :: with_capacity ( attrs. len ( ) ) ;
310- // If we have additional attributes (from a re-export),
309+ // NOTE: If we have additional attributes (from a re-export),
311310 // always insert them first. This ensure that re-export
312311 // doc comments show up before the original doc comments
313312 // when we render them.
314- if let Some ( a) = other_attrs {
315- merged_attrs. extend ( a. iter ( ) . cloned ( ) ) ;
316- }
317- merged_attrs. extend ( attrs. to_vec ( ) ) ;
313+ let merged_attrs = if let Some ( inner) = other_attrs {
314+ let mut both = inner. to_vec ( ) ;
315+ both. extend_from_slice ( attrs) ;
316+ both
317+ } else {
318+ attrs. to_vec ( )
319+ } ;
318320 merged_attrs. clean ( cx)
319321}
320322
You can’t perform that action at this time.
0 commit comments