File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -306,15 +306,17 @@ fn merge_attrs(
306
306
attrs : Attrs < ' _ > ,
307
307
other_attrs : Option < Attrs < ' _ > > ,
308
308
) -> 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),
311
310
// always insert them first. This ensure that re-export
312
311
// doc comments show up before the original doc comments
313
312
// 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
+ } ;
318
320
merged_attrs. clean ( cx)
319
321
}
320
322
You can’t perform that action at this time.
0 commit comments