@@ -2121,8 +2121,8 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21212121 Some ( DefKind :: TyAlias ) => Some ( cx. tcx . type_of ( did) . clean ( cx) ) ,
21222122 _ => None ,
21232123 } ) ;
2124- if let Some ( type_alias ) = type_alias {
2125- ret . push ( Item {
2124+ let make_item = | trait_ : Option < Type > , for_ : Type , items : Vec < Item > | {
2125+ Item {
21262126 name : None ,
21272127 attrs : self . attrs . clean ( cx) ,
21282128 source : self . whence . clean ( cx) ,
@@ -2134,35 +2134,19 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21342134 unsafety : self . unsafety ,
21352135 generics : self . generics . clean ( cx) ,
21362136 provided_trait_methods : provided. clone ( ) ,
2137- trait_ : trait_ . clone ( ) ,
2138- for_ : type_alias ,
2139- items : items . clone ( ) ,
2137+ trait_,
2138+ for_,
2139+ items,
21402140 polarity : Some ( cx. tcx . impl_polarity ( def_id) . clean ( cx) ) ,
21412141 synthetic : false ,
21422142 blanket_impl : None ,
21432143 } ) ,
2144- } ) ;
2144+ }
2145+ } ;
2146+ if let Some ( type_alias) = type_alias {
2147+ ret. push ( make_item ( trait_. clone ( ) , type_alias, items. clone ( ) ) ) ;
21452148 }
2146- ret. push ( Item {
2147- name : None ,
2148- attrs : self . attrs . clean ( cx) ,
2149- source : self . whence . clean ( cx) ,
2150- def_id,
2151- visibility : self . vis . clean ( cx) ,
2152- stability : cx. stability ( self . id ) . clean ( cx) ,
2153- deprecation : cx. deprecation ( self . id ) . clean ( cx) ,
2154- inner : ImplItem ( Impl {
2155- unsafety : self . unsafety ,
2156- generics : self . generics . clean ( cx) ,
2157- provided_trait_methods : provided,
2158- trait_,
2159- for_,
2160- items,
2161- polarity : Some ( cx. tcx . impl_polarity ( def_id) . clean ( cx) ) ,
2162- synthetic : false ,
2163- blanket_impl : None ,
2164- } ) ,
2165- } ) ;
2149+ ret. push ( make_item ( trait_, for_, items) ) ;
21662150 ret
21672151 }
21682152}
0 commit comments