diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-18 22:23:22 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-18 22:23:22 +0100 |
commit | d9666ce5098442ab0cbac4d4363435074eb12923 (patch) | |
tree | f384246a35bb32f1d7ecc39c966150fd175f00c2 /crates/ide_assists/src/handlers | |
parent | 4f6301b8f6ff79bc5114d400bdce31dc3f37216b (diff) | |
parent | 2ee090faaf69474a2baadf0494ef3c6ed4fdbcbc (diff) |
Merge #9334
9334: feat: Allow to disable import insertion on single path glob imports r=Veykril a=Veykril
On by default as I feel like this is something the majority would prefer.
Closes #8490
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_assists/src/handlers')
3 files changed, 3 insertions, 3 deletions
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<()> | |||
104 | ImportScope::File(it) => ImportScope::File(builder.make_mut(it)), | 104 | ImportScope::File(it) => ImportScope::File(builder.make_mut(it)), |
105 | ImportScope::Module(it) => ImportScope::Module(builder.make_mut(it)), | 105 | ImportScope::Module(it) => ImportScope::Module(builder.make_mut(it)), |
106 | }; | 106 | }; |
107 | insert_use(&scope, mod_path_to_ast(&import.import_path), ctx.config.insert_use); | 107 | insert_use(&scope, mod_path_to_ast(&import.import_path), &ctx.config.insert_use); |
108 | }, | 108 | }, |
109 | ); | 109 | ); |
110 | } | 110 | } |
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 6c6ff16c2..430710448 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 | |||
@@ -236,7 +236,7 @@ fn apply_references( | |||
236 | import: Option<(ImportScope, hir::ModPath)>, | 236 | import: Option<(ImportScope, hir::ModPath)>, |
237 | ) { | 237 | ) { |
238 | if let Some((scope, path)) = import { | 238 | if let Some((scope, path)) = import { |
239 | insert_use(&scope, mod_path_to_ast(&path), insert_use_cfg); | 239 | insert_use(&scope, mod_path_to_ast(&path), &insert_use_cfg); |
240 | } | 240 | } |
241 | // deep clone to prevent cycle | 241 | // deep clone to prevent cycle |
242 | let path = make::path_from_segments(iter::once(segment.clone_subtree()), false); | 242 | 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( | |||
43 | let syntax = builder.make_syntax_mut(syntax.clone()); | 43 | let syntax = builder.make_syntax_mut(syntax.clone()); |
44 | if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { | 44 | if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { |
45 | shorten_paths(&syntax, &path.clone_for_update()); | 45 | shorten_paths(&syntax, &path.clone_for_update()); |
46 | insert_use(import_scope, path, ctx.config.insert_use); | 46 | insert_use(import_scope, path, &ctx.config.insert_use); |
47 | } | 47 | } |
48 | }, | 48 | }, |
49 | ) | 49 | ) |