@@ -1715,11 +1715,16 @@ fn rewrite_static(
1715
1715
pub fn rewrite_associated_type (
1716
1716
ident : ast:: Ident ,
1717
1717
ty_opt : Option < & ptr:: P < ast:: Ty > > ,
1718
+ generics : & ast:: Generics ,
1718
1719
generic_bounds_opt : Option < & ast:: GenericBounds > ,
1719
1720
context : & RewriteContext ,
1720
1721
indent : Indent ,
1721
1722
) -> Option < String > {
1722
- let prefix = format ! ( "type {}" , rewrite_ident( context, ident) ) ;
1723
+ let ident_str = rewrite_ident ( context, ident) ;
1724
+ // 5 = "type "
1725
+ let generics_shape = Shape :: indented ( indent, context. config ) . offset_left ( 5 ) ?;
1726
+ let generics_str = rewrite_generics ( context, ident_str, generics, generics_shape) ?;
1727
+ let prefix = format ! ( "type {}" , generics_str) ;
1723
1728
1724
1729
let type_bounds_str = if let Some ( bounds) = generic_bounds_opt {
1725
1730
if bounds. is_empty ( ) {
@@ -1746,21 +1751,23 @@ pub fn rewrite_associated_type(
1746
1751
pub fn rewrite_existential_impl_type (
1747
1752
context : & RewriteContext ,
1748
1753
ident : ast:: Ident ,
1754
+ generics : & ast:: Generics ,
1749
1755
generic_bounds : & ast:: GenericBounds ,
1750
1756
indent : Indent ,
1751
1757
) -> Option < String > {
1752
- rewrite_associated_type ( ident, None , Some ( generic_bounds) , context, indent)
1758
+ rewrite_associated_type ( ident, None , generics , Some ( generic_bounds) , context, indent)
1753
1759
. map ( |s| format ! ( "existential {}" , s) )
1754
1760
}
1755
1761
1756
1762
pub fn rewrite_associated_impl_type (
1757
1763
ident : ast:: Ident ,
1758
1764
defaultness : ast:: Defaultness ,
1759
1765
ty_opt : Option < & ptr:: P < ast:: Ty > > ,
1766
+ generics : & ast:: Generics ,
1760
1767
context : & RewriteContext ,
1761
1768
indent : Indent ,
1762
1769
) -> Option < String > {
1763
- let result = rewrite_associated_type ( ident, ty_opt, None , context, indent) ?;
1770
+ let result = rewrite_associated_type ( ident, ty_opt, generics , None , context, indent) ?;
1764
1771
1765
1772
match defaultness {
1766
1773
ast:: Defaultness :: Default => Some ( format ! ( "default {}" , result) ) ,
0 commit comments