From 277df02ff562e152baac5cba93844d7499d806b5 Mon Sep 17 00:00:00 2001 From: ice1000 Date: Wed, 24 Aug 2022 05:49:59 +0000 Subject: [PATCH] This should work, but I got mysterious errors --- crates/ide-assists/src/handlers/inline_type_alias.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/ide-assists/src/handlers/inline_type_alias.rs b/crates/ide-assists/src/handlers/inline_type_alias.rs index 4afe890c78..a7f1cf49e3 100644 --- a/crates/ide-assists/src/handlers/inline_type_alias.rs +++ b/crates/ide-assists/src/handlers/inline_type_alias.rs @@ -71,6 +71,7 @@ pub(crate) fn inline_type_alias_uses(acc: &mut Assists, ctx: &AssistContext<'_>) path_type.syntax().ancestors().nth(3).and_then(ast::PathType::cast) }); + path_type_uses.iter().for_each(remove_path_if_in_use_stmt); for (target, replacement) in path_types.into_iter().filter_map(|path_type| { let replacement = inline(&ast_alias, &path_type)?.to_text(&concrete_type); let target = path_type.syntax().text_range(); @@ -78,10 +79,6 @@ pub(crate) fn inline_type_alias_uses(acc: &mut Assists, ctx: &AssistContext<'_>) }) { builder.replace(target, replacement); } - if !path_type_uses.is_empty() { - builder.edit_file(file_id); - path_type_uses.iter().for_each(remove_path_if_in_use_stmt); - } }; for (file_id, refs) in usages.into_iter() { @@ -1001,7 +998,6 @@ mod foo; //- /foo.rs - fn foo() { let _: i32 = 0; }