diff --git a/crates/assists/src/handlers/generate_function.rs b/crates/assists/src/handlers/generate_function.rs index 758188a4295..f4cf155b630 100644 --- a/crates/assists/src/handlers/generate_function.rs +++ b/crates/assists/src/handlers/generate_function.rs @@ -145,7 +145,7 @@ impl FunctionBuilder { self.type_params, self.params, fn_body, - Some(make::ret_type(make::ty("()"))), + Some(make::ret_type(make::ty_unit())), ); let leading_ws; let trailing_ws; diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 16b079c42ac..ba7e5d2fb10 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -20,6 +20,9 @@ pub fn name_ref(text: &str) -> ast::NameRef { pub fn ty(text: &str) -> ast::Type { ast_from_text(&format!("impl {} for D {{}};", text)) } +pub fn ty_unit() -> ast::Type { + ty("()") +} pub fn assoc_item_list() -> ast::AssocItemList { ast_from_text("impl C for D {};")