mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Account for generics in extract_struct_from_enum_variant
This commit is contained in:
parent
dbdfeeeff9
commit
f3dc4321c8
2 changed files with 48 additions and 20 deletions
|
@ -580,12 +580,11 @@ pub fn fn_(
|
|||
pub fn struct_(
|
||||
visibility: Option<ast::Visibility>,
|
||||
strukt_name: ast::Name,
|
||||
type_params: Option<ast::GenericParamList>,
|
||||
generic_param_list: Option<ast::GenericParamList>,
|
||||
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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue