From f3dc4321c8febf5cf3a4204e2cb444fd453350e4 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 2 Jun 2021 17:44:00 +0200 Subject: Account for generics in extract_struct_from_enum_variant --- crates/syntax/src/ast/make.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 0cf170626..4c3c9661d 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -580,12 +580,11 @@ pub fn fn_( pub fn struct_( visibility: Option, strukt_name: ast::Name, - type_params: Option, + generic_param_list: Option, field_list: ast::FieldList, ) -> ast::Struct { let semicolon = if matches!(field_list, ast::FieldList::TupleFieldList(_)) { ";" } else { "" }; - let type_params = - if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() }; + let type_params = generic_param_list.map_or_else(String::new, |it| it.to_string()); let visibility = match visibility { None => String::new(), Some(it) => format!("{} ", it), -- cgit v1.2.3