Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/bool_to_enum.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/bool_to_enum.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/crates/ide-assists/src/handlers/bool_to_enum.rs b/crates/ide-assists/src/handlers/bool_to_enum.rs index fd3a0506ab..71436e6580 100644 --- a/crates/ide-assists/src/handlers/bool_to_enum.rs +++ b/crates/ide-assists/src/handlers/bool_to_enum.rs @@ -1,4 +1,4 @@ -use hir::ModuleDef; +use hir::{ImportPathConfig, ModuleDef}; use ide_db::{ assists::{AssistId, AssistKind}, defs::Definition, @@ -326,6 +326,11 @@ fn augment_references_with_imports( ) -> Vec<FileReferenceWithImport> { let mut visited_modules = FxHashSet::default(); + let cfg = ImportPathConfig { + prefer_no_std: ctx.config.prefer_no_std, + prefer_prelude: ctx.config.prefer_prelude, + }; + references .into_iter() .filter_map(|FileReference { range, name, .. }| { @@ -341,12 +346,11 @@ fn augment_references_with_imports( let import_scope = ImportScope::find_insert_use_container(name.syntax(), &ctx.sema); let path = ref_module - .find_use_path_prefixed( + .find_use_path( ctx.sema.db, ModuleDef::Module(*target_module), ctx.config.insert_use.prefix_kind, - ctx.config.prefer_no_std, - ctx.config.prefer_prelude, + cfg, ) .map(|mod_path| { make::path_concat(mod_path_to_ast(&mod_path), make::path_from_text("Bool")) @@ -1521,7 +1525,7 @@ mod foo { } "#, r#" -use crate::foo::Bool; +use foo::Bool; fn main() { use foo::FOO; @@ -1602,7 +1606,7 @@ pub mod bar { "#, r#" //- /main.rs -use crate::foo::bar::Bool; +use foo::bar::Bool; mod foo; |