mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
internal: refactor prefer_no_std
/prefer_prelude
bools into a struct
This commit is contained in:
parent
6a16749eb0
commit
b75301cec8
37 changed files with 304 additions and 351 deletions
|
@ -12,6 +12,7 @@ mod snippet;
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use hir::ImportPathConfig;
|
||||
use ide_db::{
|
||||
base_db::FilePosition,
|
||||
helpers::mod_path_to_ast,
|
||||
|
@ -251,6 +252,11 @@ pub fn resolve_completion_edits(
|
|||
let new_ast = scope.clone_for_update();
|
||||
let mut import_insert = TextEdit::builder();
|
||||
|
||||
let cfg = ImportPathConfig {
|
||||
prefer_no_std: config.prefer_no_std,
|
||||
prefer_prelude: config.prefer_prelude,
|
||||
};
|
||||
|
||||
imports.into_iter().for_each(|(full_import_path, imported_name)| {
|
||||
let items_with_name = items_locator::items_with_name(
|
||||
&sema,
|
||||
|
@ -264,8 +270,7 @@ pub fn resolve_completion_edits(
|
|||
db,
|
||||
candidate,
|
||||
config.insert_use.prefix_kind,
|
||||
config.prefer_no_std,
|
||||
config.prefer_prelude,
|
||||
cfg,
|
||||
)
|
||||
})
|
||||
.find(|mod_path| mod_path.display(db).to_string() == full_import_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue