Skip to content

Commit b9b09cf

Browse files
committed
replace make with syntax_factory definitions
1 parent 5ce99f1 commit b9b09cf

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

crates/ide-assists/src/handlers/expand_glob_import.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use ide_db::{
88
use stdx::never;
99
use syntax::{
1010
AstNode, Direction, SyntaxNode, SyntaxToken, T,
11-
ast::{self, Use, UseTree, VisibilityKind, make},
11+
ast::{self, Use, UseTree, VisibilityKind, syntax_factory::SyntaxFactory},
1212
};
1313

1414
use crate::{
@@ -148,6 +148,8 @@ fn build_expanded_import(
148148
current_module: Module,
149149
reexport_public_items: bool,
150150
) {
151+
let make = SyntaxFactory::with_mappings();
152+
let mut editor = builder.make_editor(use_tree.syntax());
151153
let (must_be_pub, visible_from) = if !reexport_public_items {
152154
(false, current_module)
153155
} else {
@@ -167,15 +169,13 @@ fn build_expanded_import(
167169
if reexport_public_items { refs_in_target } else { refs_in_target.used_refs(ctx) };
168170

169171
let names_to_import = find_names_to_import(filtered_defs, imported_defs);
170-
let expanded = make::use_tree_list(names_to_import.iter().map(|n| {
171-
let path = make::ext::ident_path(
172+
let expanded = make.use_tree_list(names_to_import.iter().map(|n| {
173+
let path = make.ident_path(
172174
&n.display(ctx.db(), current_module.krate(ctx.db()).edition(ctx.db())).to_string(),
173175
);
174-
make::use_tree(path, None, None, false)
175-
}))
176-
.clone_for_update();
176+
make.use_tree(path, None, None, false)
177+
}));
177178

178-
let mut editor = builder.make_editor(use_tree.syntax());
179179
match use_tree.star_token() {
180180
Some(star) => {
181181
let needs_braces = use_tree.path().is_some() && names_to_import.len() != 1;
@@ -192,6 +192,7 @@ fn build_expanded_import(
192192
}
193193
None => never!(),
194194
}
195+
editor.add_mappings(make.finish_with_mappings());
195196
builder.add_file_edits(ctx.vfs_file_id(), editor);
196197
}
197198

0 commit comments

Comments
 (0)