fix: hide destructure_struct_binding assist if no public fields

This commit is contained in:
Niklas Lindorfer 2024-03-04 18:14:25 +00:00
parent 9f14343f9e
commit 2a4ba4295b
No known key found for this signature in database
GPG key ID: D19D86B8C7F455A8
2 changed files with 23 additions and 9 deletions

View file

@ -724,7 +724,10 @@ pub fn record_pat_field_list(
) -> ast::RecordPatFieldList {
let mut fields = fields.into_iter().join(", ");
if let Some(rest_pat) = rest_pat {
format_to!(fields, ", {rest_pat}");
if !fields.is_empty() {
fields.push_str(", ");
}
format_to!(fields, "{rest_pat}");
}
ast_from_text(&format!("fn f(S {{ {fields} }}: ()))"))
}