Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4601331

Browse files
committed
Simple fix for make::impl_trait
1 parent a646439 commit 4601331

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/syntax/src/ast/make.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ pub fn impl_trait(
184184
ty: ast::Path,
185185
ty_params: Option<ast::GenericParamList>,
186186
) -> ast::Impl {
187-
let ty_params = ty_params.map_or_else(String::new, |params| params.to_string());
188-
ast_from_text(&format!("impl{ty_params} {trait_} for {ty}{ty_params} {{}}"))
187+
// TODO : If this function is now correct we can also change `impl_` accordingly`
188+
let ty_params_str = ty_params.as_ref().map_or_else(String::new, |params| params.to_string());
189+
let ty_genargs_str =
190+
ty_params.map_or_else(String::new, |params| params.to_generic_args().to_string());
191+
ast_from_text(&format!("impl{ty_params_str} {trait_} for {ty}{ty_genargs_str} {{}}"))
189192
}
190193

191194
pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {

0 commit comments

Comments
 (0)