From 1859df37fd6e308ea4304f69baae038ec09fe424 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 16 May 2021 18:10:56 +0300 Subject: internal: use mutable syntax trees when filling fields --- crates/ide/src/diagnostics/fixes.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ide/src/diagnostics/fixes.rs') diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index 15821500f..695b59e27 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs @@ -100,11 +100,12 @@ impl DiagnosticWithFix for MissingFields { let root = sema.db.parse_or_expand(self.file)?; let field_list_parent = self.field_list_parent.to_node(&root); let old_field_list = field_list_parent.record_expr_field_list()?; - let mut new_field_list = old_field_list.clone(); + let new_field_list = old_field_list.clone_for_update(); for f in self.missed_fields.iter() { let field = - make::record_expr_field(make::name_ref(&f.to_string()), Some(make::expr_unit())); - new_field_list = new_field_list.append_field(&field); + make::record_expr_field(make::name_ref(&f.to_string()), Some(make::expr_unit())) + .clone_for_update(); + new_field_list.add_field(field); } let edit = { -- cgit v1.2.3