From 4601331ceb07ff8669b4089a18be676ae614009f Mon Sep 17 00:00:00 2001 From: alibektas Date: Mon, 17 Apr 2023 00:41:08 +0300 Subject: [PATCH] Simple fix for make::impl_trait --- crates/syntax/src/ast/make.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 5aebe4cd9f5..c56ddb51609 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -184,8 +184,11 @@ pub fn impl_trait( ty: ast::Path, ty_params: Option, ) -> ast::Impl { - let ty_params = ty_params.map_or_else(String::new, |params| params.to_string()); - ast_from_text(&format!("impl{ty_params} {trait_} for {ty}{ty_params} {{}}")) + // TODO : If this function is now correct we can also change `impl_` accordingly` + let ty_params_str = ty_params.as_ref().map_or_else(String::new, |params| params.to_string()); + let ty_genargs_str = + ty_params.map_or_else(String::new, |params| params.to_generic_args().to_string()); + ast_from_text(&format!("impl{ty_params_str} {trait_} for {ty}{ty_genargs_str} {{}}")) } pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {