]> git.lizzy.rs Git - rust.git/commitdiff
Minor, cleanup API
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 18 Dec 2020 16:50:00 +0000 (19:50 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 18 Dec 2020 16:50:00 +0000 (19:50 +0300)
crates/assists/src/handlers/generate_function.rs
crates/syntax/src/ast/make.rs

index 758188a42956aa7133706a7e84f893156699b6df..f4cf155b6306ab9e04bf7ac40bb16ed9fdcc3239 100644 (file)
@@ -145,7 +145,7 @@ fn render(self) -> FunctionTemplate {
             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;
index 16b079c42acf04a71d82a2c6fc02fbe6f6605c07..ba7e5d2fb10524751803cf9174c0543b2ed9ece5 100644 (file)
@@ -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 {};")