mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
This commit is contained in:
parent
6909556435
commit
7d19971666
33 changed files with 156 additions and 43 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue