File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
crates/ra_ide/src/display Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,18 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
207
207
res. push ( raw_param) ;
208
208
}
209
209
210
- res. extend ( param_list. params ( ) . map ( |param| param. syntax ( ) . text ( ) . to_string ( ) ) ) ;
210
+ // macro-generated functions are missing whitespace
211
+ fn fmt_param ( param : ast:: Param ) -> String {
212
+ let text = param. syntax ( ) . text ( ) . to_string ( ) ;
213
+ match text. find ( ':' ) {
214
+ Some ( pos) if 1 + pos < text. len ( ) => {
215
+ format ! ( "{} {}" , & text[ 0 ..1 + pos] . trim( ) , & text[ 1 + pos..] . trim( ) )
216
+ }
217
+ _ => text,
218
+ }
219
+ }
220
+
221
+ res. extend ( param_list. params ( ) . map ( fmt_param) ) ;
211
222
res_types. extend ( param_list. params ( ) . map ( |param| {
212
223
let param_text = param. syntax ( ) . text ( ) . to_string ( ) ;
213
224
match param_text. split ( ':' ) . nth ( 1 ) . and_then ( |it| it. get ( 1 ..) ) {
You can’t perform that action at this time.
0 commit comments