From 2ee090faaf69474a2baadf0494ef3c6ed4fdbcbc Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 18 Jun 2021 23:11:56 +0200 Subject: Allow to disable import insertion on single path glob imports --- crates/ide_assists/src/handlers/auto_import.rs | 2 +- crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs | 2 +- crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide_assists/src/handlers') diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index d4748ef3a..6c7348178 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs @@ -104,7 +104,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> ImportScope::File(it) => ImportScope::File(builder.make_mut(it)), ImportScope::Module(it) => ImportScope::Module(builder.make_mut(it)), }; - insert_use(&scope, mod_path_to_ast(&import.import_path), ctx.config.insert_use); + insert_use(&scope, mod_path_to_ast(&import.import_path), &ctx.config.insert_use); }, ); } 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 d3ff7b65c..da6df9106 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 @@ -235,7 +235,7 @@ fn apply_references( import: Option<(ImportScope, hir::ModPath)>, ) { if let Some((scope, path)) = import { - insert_use(&scope, mod_path_to_ast(&path), insert_use_cfg); + insert_use(&scope, mod_path_to_ast(&path), &insert_use_cfg); } // deep clone to prevent cycle let path = make::path_from_segments(iter::once(segment.clone_subtree()), false); 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 39f5eb4ff..26019c793 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 @@ -43,7 +43,7 @@ pub(crate) fn replace_qualified_name_with_use( let syntax = builder.make_syntax_mut(syntax.clone()); if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { shorten_paths(&syntax, &path.clone_for_update()); - insert_use(import_scope, path, ctx.config.insert_use); + insert_use(import_scope, path, &ctx.config.insert_use); } }, ) -- cgit v1.2.3