Unnamed repository; edit this file 'description' to name the repository.
migrate generate_single_field_struct_from to use use_trivial_constructor_with_factory and also restructured it
bit-aloo 4 weeks ago
parent 4ce95b8 · commit e735635
-rw-r--r--crates/ide-assists/src/handlers/generate_single_field_struct_from.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs b/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
index 10c009a2ea..265a632a8c 100644
--- a/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
+++ b/crates/ide-assists/src/handlers/generate_single_field_struct_from.rs
@@ -1,8 +1,9 @@
use hir::next_solver::{DbInterner, TypingMode};
use hir::{HasCrate, ModuleDef, Semantics};
+use ide_db::use_trivial_constructor::use_trivial_constructor_with_factory;
use ide_db::{
- RootDatabase, famous_defs::FamousDefs, helpers::mod_path_to_ast,
- imports::import_assets::item_for_path_search, use_trivial_constructor::use_trivial_constructor,
+ RootDatabase, famous_defs::FamousDefs, helpers::mod_path_to_ast_with_factory,
+ imports::import_assets::item_for_path_search,
};
use syntax::syntax_editor::{Position, SyntaxEditor};
use syntax::{
@@ -197,7 +198,13 @@ fn make_constructors(
let ty_path = module.find_path(db, item_for_path_search(db, item_in_ns)?, cfg)?;
- use_trivial_constructor(db, mod_path_to_ast(&ty_path, edition), &ty, edition)
+ use_trivial_constructor_with_factory(
+ &make,
+ db,
+ mod_path_to_ast_with_factory(&make, &ty_path, edition),
+ &ty,
+ edition,
+ )
})
.collect()
}