Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
This commit is contained in:
@@ -137,6 +137,7 @@ pub(crate) fn json_in_items(
|
||||
sema.db,
|
||||
it,
|
||||
config.insert_use.prefix_kind,
|
||||
config.prefer_core,
|
||||
) {
|
||||
insert_use(
|
||||
&scope,
|
||||
@@ -152,6 +153,7 @@ pub(crate) fn json_in_items(
|
||||
sema.db,
|
||||
it,
|
||||
config.insert_use.prefix_kind,
|
||||
config.prefer_core,
|
||||
) {
|
||||
insert_use(
|
||||
&scope,
|
||||
|
||||
@@ -124,6 +124,7 @@ fn fixes(ctx: &DiagnosticsContext<'_>, d: &hir::MissingFields) -> Option<Vec<Ass
|
||||
let type_path = current_module?.find_use_path(
|
||||
ctx.sema.db,
|
||||
item_for_path_search(ctx.sema.db, item_in_ns)?,
|
||||
ctx.config.prefer_core,
|
||||
)?;
|
||||
|
||||
use_trivial_constructor(
|
||||
|
||||
@@ -150,6 +150,7 @@ pub struct DiagnosticsConfig {
|
||||
pub expr_fill_default: ExprFillDefaultMode,
|
||||
// FIXME: We may want to include a whole `AssistConfig` here
|
||||
pub insert_use: InsertUseConfig,
|
||||
pub prefer_core: bool,
|
||||
}
|
||||
|
||||
impl DiagnosticsConfig {
|
||||
@@ -170,6 +171,7 @@ impl DiagnosticsConfig {
|
||||
group: false,
|
||||
skip_glob_imports: false,
|
||||
},
|
||||
prefer_core: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user