Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-assists/src/assist_config.rs11
-rw-r--r--crates/ide-assists/src/handlers/add_missing_match_arms.rs6
-rw-r--r--crates/ide-assists/src/handlers/auto_import.rs21
-rw-r--r--crates/ide-assists/src/handlers/bool_to_enum.rs8
-rw-r--r--crates/ide-assists/src/handlers/convert_into_to_from.rs7
-rw-r--r--crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs8
-rw-r--r--crates/ide-assists/src/handlers/destructure_struct_binding.rs8
-rw-r--r--crates/ide-assists/src/handlers/extract_function.rs10
-rw-r--r--crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs8
-rw-r--r--crates/ide-assists/src/handlers/generate_deref.rs24
-rw-r--r--crates/ide-assists/src/handlers/generate_new.rs7
-rw-r--r--crates/ide-assists/src/handlers/qualify_method_call.rs11
-rw-r--r--crates/ide-assists/src/handlers/qualify_path.rs31
-rw-r--r--crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs12
-rw-r--r--crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs8
-rw-r--r--crates/ide-assists/src/handlers/term_search.rs16
-rw-r--r--crates/ide-assists/src/handlers/toggle_async_sugar.rs8
17 files changed, 65 insertions, 139 deletions
diff --git a/crates/ide-assists/src/assist_config.rs b/crates/ide-assists/src/assist_config.rs
index f1de6aba05..82d8db4258 100644
--- a/crates/ide-assists/src/assist_config.rs
+++ b/crates/ide-assists/src/assist_config.rs
@@ -4,6 +4,7 @@
//! module, and we use to statically check that we only produce snippet
//! assists if we are allowed to.
+use hir::ImportPathConfig;
use ide_db::{imports::insert_use::InsertUseConfig, SnippetCap};
use crate::AssistKind;
@@ -20,3 +21,13 @@ pub struct AssistConfig {
pub term_search_fuel: u64,
pub term_search_borrowck: bool,
}
+
+impl AssistConfig {
+ pub fn import_path_config(&self) -> ImportPathConfig {
+ ImportPathConfig {
+ prefer_no_std: self.prefer_no_std,
+ prefer_prelude: self.prefer_prelude,
+ prefer_absolute: self.prefer_absolute,
+ }
+ }
+}
diff --git a/crates/ide-assists/src/handlers/add_missing_match_arms.rs b/crates/ide-assists/src/handlers/add_missing_match_arms.rs
index e1bf6b27bc..f4569ca848 100644
--- a/crates/ide-assists/src/handlers/add_missing_match_arms.rs
+++ b/crates/ide-assists/src/handlers/add_missing_match_arms.rs
@@ -71,11 +71,7 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext<'_>)
.filter(|pat| !matches!(pat, Pat::WildcardPat(_)))
.collect();
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
let module = ctx.sema.scope(expr.syntax())?.module();
let (mut missing_pats, is_non_exhaustive, has_hidden_variants): (
diff --git a/crates/ide-assists/src/handlers/auto_import.rs b/crates/ide-assists/src/handlers/auto_import.rs
index 80e80507ad..db53e49d84 100644
--- a/crates/ide-assists/src/handlers/auto_import.rs
+++ b/crates/ide-assists/src/handlers/auto_import.rs
@@ -1,6 +1,6 @@
use std::cmp::Reverse;
-use hir::{db::HirDatabase, ImportPathConfig, Module};
+use hir::{db::HirDatabase, Module};
use ide_db::{
helpers::mod_path_to_ast,
imports::{
@@ -90,11 +90,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel};
// # pub mod std { pub mod collections { pub struct HashMap { } } }
// ```
pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
let (import_assets, syntax_under_caret) = find_importable_node(ctx)?;
let mut proposed_imports: Vec<_> = import_assets
@@ -108,7 +104,6 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
NodeOrToken::Node(node) => ctx.sema.original_range(node).range,
NodeOrToken::Token(token) => token.text_range(),
};
- let group_label = group_label(import_assets.import_candidate());
let scope = ImportScope::find_insert_use_container(
&match syntax_under_caret {
NodeOrToken::Node(it) => it,
@@ -121,18 +116,12 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
proposed_imports.sort_by(|a, b| a.import_path.cmp(&b.import_path));
proposed_imports.dedup_by(|a, b| a.import_path == b.import_path);
- let current_node = match ctx.covering_element() {
- NodeOrToken::Node(node) => Some(node),
- NodeOrToken::Token(token) => token.parent(),
- };
-
- let current_module =
- current_node.as_ref().and_then(|node| ctx.sema.scope(node)).map(|scope| scope.module());
-
+ let current_module = ctx.sema.scope(scope.as_syntax_node()).map(|scope| scope.module());
// prioritize more relevant imports
proposed_imports
.sort_by_key(|import| Reverse(relevance_score(ctx, import, current_module.as_ref())));
+ let group_label = group_label(import_assets.import_candidate());
for import in proposed_imports {
let import_path = import.import_path;
@@ -226,7 +215,7 @@ fn group_label(import_candidate: &ImportCandidate) -> GroupLabel {
/// Determine how relevant a given import is in the current context. Higher scores are more
/// relevant.
-fn relevance_score(
+pub(crate) fn relevance_score(
ctx: &AssistContext<'_>,
import: &LocatedImport,
current_module: Option<&Module>,
diff --git a/crates/ide-assists/src/handlers/bool_to_enum.rs b/crates/ide-assists/src/handlers/bool_to_enum.rs
index 65fd01fa51..3a0754d60f 100644
--- a/crates/ide-assists/src/handlers/bool_to_enum.rs
+++ b/crates/ide-assists/src/handlers/bool_to_enum.rs
@@ -1,5 +1,5 @@
use either::Either;
-use hir::{ImportPathConfig, ModuleDef};
+use hir::ModuleDef;
use ide_db::{
assists::{AssistId, AssistKind},
defs::Definition,
@@ -337,11 +337,7 @@ 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,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
references
.into_iter()
diff --git a/crates/ide-assists/src/handlers/convert_into_to_from.rs b/crates/ide-assists/src/handlers/convert_into_to_from.rs
index 5349e86cf3..5aa94590e6 100644
--- a/crates/ide-assists/src/handlers/convert_into_to_from.rs
+++ b/crates/ide-assists/src/handlers/convert_into_to_from.rs
@@ -1,4 +1,3 @@
-use hir::ImportPathConfig;
use ide_db::{famous_defs::FamousDefs, helpers::mod_path_to_ast, traits::resolve_target_trait};
use syntax::ast::{self, AstNode, HasGenericArgs, HasName};
@@ -44,11 +43,7 @@ pub(crate) fn convert_into_to_from(acc: &mut Assists, ctx: &AssistContext<'_>) -
return None;
}
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
let src_type_path = {
let src_type_path = src_type.syntax().descendants().find_map(ast::Path::cast)?;
diff --git a/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs b/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs
index 7432fc7709..0f0b4442d8 100644
--- a/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs
+++ b/crates/ide-assists/src/handlers/convert_tuple_return_type_to_struct.rs
@@ -1,5 +1,5 @@
use either::Either;
-use hir::{ImportPathConfig, ModuleDef};
+use hir::ModuleDef;
use ide_db::{
assists::{AssistId, AssistKind},
defs::Definition,
@@ -183,11 +183,7 @@ fn augment_references_with_imports(
) -> Vec<(ast::NameLike, Option<(ImportScope, ast::Path)>)> {
let mut visited_modules = FxHashSet::default();
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
references
.iter()
diff --git a/crates/ide-assists/src/handlers/destructure_struct_binding.rs b/crates/ide-assists/src/handlers/destructure_struct_binding.rs
index da902f7e10..095b8f958d 100644
--- a/crates/ide-assists/src/handlers/destructure_struct_binding.rs
+++ b/crates/ide-assists/src/handlers/destructure_struct_binding.rs
@@ -1,4 +1,4 @@
-use hir::{sym, HasVisibility, ImportPathConfig};
+use hir::{sym, HasVisibility};
use ide_db::{
assists::{AssistId, AssistKind},
defs::Definition,
@@ -87,11 +87,7 @@ fn collect_data(ident_pat: ast::IdentPat, ctx: &AssistContext<'_>) -> Option<Str
let ty = ctx.sema.type_of_binding_in_pat(&ident_pat)?;
let hir::Adt::Struct(struct_type) = ty.strip_references().as_adt()? else { return None };
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
let module = ctx.sema.scope(ident_pat.syntax())?.module();
let struct_def = hir::ModuleDef::from(struct_type);
diff --git a/crates/ide-assists/src/handlers/extract_function.rs b/crates/ide-assists/src/handlers/extract_function.rs
index 20c37f9233..0a2cb6d5ef 100644
--- a/crates/ide-assists/src/handlers/extract_function.rs
+++ b/crates/ide-assists/src/handlers/extract_function.rs
@@ -3,8 +3,8 @@ use std::{iter, ops::RangeInclusive};
use ast::make;
use either::Either;
use hir::{
- DescendPreference, HasSource, HirDisplay, ImportPathConfig, InFile, Local, LocalSource,
- ModuleDef, PathResolution, Semantics, TypeInfo, TypeParam,
+ DescendPreference, HasSource, HirDisplay, InFile, Local, LocalSource, ModuleDef,
+ PathResolution, Semantics, TypeInfo, TypeParam,
};
use ide_db::{
defs::{Definition, NameRefClass},
@@ -213,11 +213,7 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
ctx.sema.db,
ModuleDef::from(control_flow_enum),
ctx.config.insert_use.prefix_kind,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
);
if let Some(mod_path) = mod_path {
diff --git a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
index cd483c1b57..a62fdeb617 100644
--- a/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide-assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -1,7 +1,7 @@
use std::iter;
use either::Either;
-use hir::{ImportPathConfig, Module, ModuleDef, Name, Variant};
+use hir::{Module, ModuleDef, Name, Variant};
use ide_db::{
defs::Definition,
helpers::mod_path_to_ast,
@@ -390,11 +390,7 @@ fn process_references(
ctx.sema.db,
*enum_module_def,
ctx.config.insert_use.prefix_kind,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
);
if let Some(mut mod_path) = mod_path {
mod_path.pop_segment();
diff --git a/crates/ide-assists/src/handlers/generate_deref.rs b/crates/ide-assists/src/handlers/generate_deref.rs
index cc33439dd5..2ac7057fe7 100644
--- a/crates/ide-assists/src/handlers/generate_deref.rs
+++ b/crates/ide-assists/src/handlers/generate_deref.rs
@@ -1,6 +1,6 @@
use std::fmt::Display;
-use hir::{ImportPathConfig, ModPath, ModuleDef};
+use hir::{ModPath, ModuleDef};
use ide_db::{famous_defs::FamousDefs, RootDatabase};
use syntax::{
ast::{self, HasName},
@@ -58,15 +58,8 @@ fn generate_record_deref(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<(
let module = ctx.sema.to_def(&strukt)?.module(ctx.db());
let trait_ = deref_type_to_generate.to_trait(&ctx.sema, module.krate())?;
- let trait_path = module.find_path(
- ctx.db(),
- ModuleDef::Trait(trait_),
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
- )?;
+ let trait_path =
+ module.find_path(ctx.db(), ModuleDef::Trait(trait_), ctx.config.import_path_config())?;
let field_type = field.ty()?;
let field_name = field.name()?;
@@ -106,15 +99,8 @@ fn generate_tuple_deref(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()
let module = ctx.sema.to_def(&strukt)?.module(ctx.db());
let trait_ = deref_type_to_generate.to_trait(&ctx.sema, module.krate())?;
- let trait_path = module.find_path(
- ctx.db(),
- ModuleDef::Trait(trait_),
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
- )?;
+ let trait_path =
+ module.find_path(ctx.db(), ModuleDef::Trait(trait_), ctx.config.import_path_config())?;
let field_type = field.ty()?;
let target = field.syntax().text_range();
diff --git a/crates/ide-assists/src/handlers/generate_new.rs b/crates/ide-assists/src/handlers/generate_new.rs
index 6056c80888..b985b5e66c 100644
--- a/crates/ide-assists/src/handlers/generate_new.rs
+++ b/crates/ide-assists/src/handlers/generate_new.rs
@@ -1,4 +1,3 @@
-use hir::ImportPathConfig;
use ide_db::{
imports::import_assets::item_for_path_search, use_trivial_constructor::use_trivial_constructor,
};
@@ -62,11 +61,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option
let type_path = current_module.find_path(
ctx.sema.db,
item_for_path_search(ctx.sema.db, item_in_ns)?,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
)?;
let expr = use_trivial_constructor(
diff --git a/crates/ide-assists/src/handlers/qualify_method_call.rs b/crates/ide-assists/src/handlers/qualify_method_call.rs
index 89e24fafc5..b1e98045fc 100644
--- a/crates/ide-assists/src/handlers/qualify_method_call.rs
+++ b/crates/ide-assists/src/handlers/qualify_method_call.rs
@@ -1,7 +1,4 @@
-use hir::{
- db::HirDatabase, AsAssocItem, AssocItem, AssocItemContainer, ImportPathConfig, ItemInNs,
- ModuleDef,
-};
+use hir::{db::HirDatabase, AsAssocItem, AssocItem, AssocItemContainer, ItemInNs, ModuleDef};
use ide_db::assists::{AssistId, AssistKind};
use syntax::{ast, AstNode};
@@ -50,11 +47,7 @@ pub(crate) fn qualify_method_call(acc: &mut Assists, ctx: &AssistContext<'_>) ->
let receiver_path = current_module.find_path(
ctx.sema.db,
item_for_path_search(ctx.sema.db, item_in_ns)?,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
)?;
let qualify_candidate = QualifyCandidate::ImplMethod(ctx.sema.db, call, resolved_call);
diff --git a/crates/ide-assists/src/handlers/qualify_path.rs b/crates/ide-assists/src/handlers/qualify_path.rs
index 4164a4c102..d8e7da15d5 100644
--- a/crates/ide-assists/src/handlers/qualify_path.rs
+++ b/crates/ide-assists/src/handlers/qualify_path.rs
@@ -1,6 +1,7 @@
+use std::cmp::Reverse;
use std::iter;
-use hir::{AsAssocItem, ImportPathConfig};
+use hir::AsAssocItem;
use ide_db::RootDatabase;
use ide_db::{
helpers::mod_path_to_ast,
@@ -38,11 +39,7 @@ use crate::{
// ```
pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
let (import_assets, syntax_under_caret) = find_importable_node(ctx)?;
- let cfg = ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- };
+ let cfg = ctx.config.import_path_config();
let mut proposed_imports: Vec<_> =
import_assets.search_for_relative_paths(&ctx.sema, cfg).collect();
@@ -50,12 +47,8 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option
return None;
}
- let range = match &syntax_under_caret {
- NodeOrToken::Node(node) => ctx.sema.original_range(node).range,
- NodeOrToken::Token(token) => token.text_range(),
- };
let candidate = import_assets.import_candidate();
- let qualify_candidate = match syntax_under_caret {
+ let qualify_candidate = match syntax_under_caret.clone() {
NodeOrToken::Node(syntax_under_caret) => match candidate {
ImportCandidate::Path(candidate) if candidate.qualifier.is_some() => {
cov_mark::hit!(qualify_path_qualifier_start);
@@ -89,6 +82,22 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option
proposed_imports.sort_by(|a, b| a.import_path.cmp(&b.import_path));
proposed_imports.dedup_by(|a, b| a.import_path == b.import_path);
+ let range = match &syntax_under_caret {
+ NodeOrToken::Node(node) => ctx.sema.original_range(node).range,
+ NodeOrToken::Token(token) => token.text_range(),
+ };
+ let current_module = ctx
+ .sema
+ .scope(&match syntax_under_caret {
+ NodeOrToken::Node(node) => node.clone(),
+ NodeOrToken::Token(t) => t.parent()?,
+ })
+ .map(|scope| scope.module());
+ // prioritize more relevant imports
+ proposed_imports.sort_by_key(|import| {
+ Reverse(super::auto_import::relevance_score(ctx, import, current_module.as_ref()))
+ });
+
let group_label = group_label(candidate);
for import in proposed_imports {
acc.add_group(
diff --git a/crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs
index 5582256a17..5ff4af19fb 100644
--- a/crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs
+++ b/crates/ide-assists/src/handlers/replace_derive_with_manual_impl.rs
@@ -1,4 +1,4 @@
-use hir::{ImportPathConfig, InFile, MacroFileIdExt, ModuleDef};
+use hir::{InFile, MacroFileIdExt, ModuleDef};
use ide_db::{helpers::mod_path_to_ast, imports::import_assets::NameToImport, items_locator};
use itertools::Itertools;
use syntax::{
@@ -83,15 +83,7 @@ pub(crate) fn replace_derive_with_manual_impl(
})
.flat_map(|trait_| {
current_module
- .find_path(
- ctx.sema.db,
- hir::ModuleDef::Trait(trait_),
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
- )
+ .find_path(ctx.sema.db, hir::ModuleDef::Trait(trait_), ctx.config.import_path_config())
.as_ref()
.map(mod_path_to_ast)
.zip(Some(trait_))
diff --git a/crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs
index b4e1a49aab..d0aa835e79 100644
--- a/crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs
+++ b/crates/ide-assists/src/handlers/replace_qualified_name_with_use.rs
@@ -1,4 +1,4 @@
-use hir::{AsAssocItem, ImportPathConfig};
+use hir::AsAssocItem;
use ide_db::{
helpers::mod_path_to_ast,
imports::insert_use::{insert_use, ImportScope},
@@ -67,11 +67,7 @@ pub(crate) fn replace_qualified_name_with_use(
ctx.sema.db,
module,
ctx.config.insert_use.prefix_kind,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
)
})
.flatten();
diff --git a/crates/ide-assists/src/handlers/term_search.rs b/crates/ide-assists/src/handlers/term_search.rs
index 7a91179975..4913cfdea9 100644
--- a/crates/ide-assists/src/handlers/term_search.rs
+++ b/crates/ide-assists/src/handlers/term_search.rs
@@ -1,8 +1,5 @@
//! Term search assist
-use hir::{
- term_search::{TermSearchConfig, TermSearchCtx},
- ImportPathConfig,
-};
+use hir::term_search::{TermSearchConfig, TermSearchCtx};
use ide_db::{
assists::{AssistId, AssistKind, GroupLabel},
famous_defs::FamousDefs,
@@ -54,16 +51,7 @@ pub(crate) fn term_search(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
let paths = paths
.into_iter()
.filter_map(|path| {
- path.gen_source_code(
- &scope,
- &mut formatter,
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
- )
- .ok()
+ path.gen_source_code(&scope, &mut formatter, ctx.config.import_path_config()).ok()
})
.unique();
diff --git a/crates/ide-assists/src/handlers/toggle_async_sugar.rs b/crates/ide-assists/src/handlers/toggle_async_sugar.rs
index 31d18a6013..98975a324d 100644
--- a/crates/ide-assists/src/handlers/toggle_async_sugar.rs
+++ b/crates/ide-assists/src/handlers/toggle_async_sugar.rs
@@ -1,4 +1,4 @@
-use hir::{ImportPathConfig, ModuleDef};
+use hir::ModuleDef;
use ide_db::{
assists::{AssistId, AssistKind},
famous_defs::FamousDefs,
@@ -139,11 +139,7 @@ pub(crate) fn desugar_async_into_impl_future(
let trait_path = module.find_path(
ctx.db(),
ModuleDef::Trait(future_trait),
- ImportPathConfig {
- prefer_no_std: ctx.config.prefer_no_std,
- prefer_prelude: ctx.config.prefer_prelude,
- prefer_absolute: ctx.config.prefer_absolute,
- },
+ ctx.config.import_path_config(),
)?;
let trait_path = trait_path.display(ctx.db());