Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/make.rs')
| -rw-r--r-- | crates/syntax/src/ast/make.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index a35983435c..78ed2a73e5 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -823,6 +823,7 @@ pub fn fn_( visibility: Option<ast::Visibility>, fn_name: ast::Name, type_params: Option<ast::GenericParamList>, + where_clause: Option<ast::WhereClause>, params: ast::ParamList, body: ast::BlockExpr, ret_type: Option<ast::RetType>, @@ -832,6 +833,10 @@ pub fn fn_( Some(type_params) => format!("{type_params}"), None => "".into(), }; + let where_clause = match where_clause { + Some(it) => format!("{it} "), + None => "".into(), + }; let ret_type = match ret_type { Some(ret_type) => format!("{ret_type} "), None => "".into(), @@ -844,7 +849,7 @@ pub fn fn_( let async_literal = if is_async { "async " } else { "" }; ast_from_text(&format!( - "{visibility}{async_literal}fn {fn_name}{type_params}{params} {ret_type}{body}", + "{visibility}{async_literal}fn {fn_name}{type_params}{params} {ret_type}{where_clause}{body}", )) } |