@@ -945,6 +945,10 @@ impl<'a> fmt::Display for Method<'a> {
945
945
let mut args = String :: new ( ) ;
946
946
let mut args_plain = String :: new ( ) ;
947
947
for ( i, input) in decl. inputs . values . iter ( ) . enumerate ( ) {
948
+ if i == 0 {
949
+ args. push_str ( "<br>" ) ;
950
+ }
951
+
948
952
if let Some ( selfty) = input. to_self ( ) {
949
953
match selfty {
950
954
clean:: SelfValue => {
@@ -986,8 +990,8 @@ impl<'a> fmt::Display for Method<'a> {
986
990
args_plain. push_str ( & format ! ( "{:#}" , input. type_) ) ;
987
991
}
988
992
if i + 1 < decl. inputs . values . len ( ) {
989
- args. push_str ( "," ) ;
990
- args_plain. push_str ( "," ) ;
993
+ args. push ( ',' ) ;
994
+ args_plain. push ( ',' ) ;
991
995
}
992
996
}
993
997
@@ -1003,27 +1007,19 @@ impl<'a> fmt::Display for Method<'a> {
1003
1007
format ! ( "{}" , decl. output)
1004
1008
} ;
1005
1009
1006
- let mut output: String ;
1007
- let plain: String ;
1008
1010
let pad = repeat ( " " ) . take ( indent) . collect :: < String > ( ) ;
1009
- if arrow. is_empty ( ) {
1010
- output = format ! ( "({})" , args) ;
1011
- plain = format ! ( "{}({})" , pad, args_plain) ;
1011
+ let plain = format ! ( "{pad}({args}){arrow}" ,
1012
+ pad = pad,
1013
+ args = args_plain,
1014
+ arrow = arrow_plain) ;
1015
+
1016
+ let output = if plain. len ( ) > 80 {
1017
+ let pad = "<br> " ;
1018
+ format ! ( "({args}<br>){arrow}" , args = args. replace( "<br>" , pad) , arrow = arrow)
1012
1019
} else {
1013
- output = format ! ( "({args})<br>{arrow}" , args = args, arrow = arrow) ;
1014
- plain = format ! ( "{pad}({args}){arrow}" ,
1015
- pad = pad,
1016
- args = args_plain,
1017
- arrow = arrow_plain) ;
1018
- }
1020
+ format ! ( "({args}){arrow}" , args = args. replace( "<br>" , "" ) , arrow = arrow)
1021
+ } ;
1019
1022
1020
- if plain. len ( ) > 80 {
1021
- let pad = repeat ( " " ) . take ( indent) . collect :: < String > ( ) ;
1022
- let pad = format ! ( "<br>{}" , pad) ;
1023
- output = output. replace ( "<br>" , & pad) ;
1024
- } else {
1025
- output = output. replace ( "<br>" , "" ) ;
1026
- }
1027
1023
if f. alternate ( ) {
1028
1024
write ! ( f, "{}" , output. replace( "<br>" , "\n " ) )
1029
1025
} else {
0 commit comments