diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-07 08:24:02 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-07 08:24:02 +0000 |
commit | d54e1157b66017e4aae38328cd213286e39ca130 (patch) | |
tree | f7cd48d085b2bad9b8cdc528b677cdd8cfa2d0ef /crates/ide_assists | |
parent | 708ec9821f9bcfeafbc82f8260c264fb32b8b750 (diff) | |
parent | 96fc01a30b88d95619b26fd96c58627dd54cb339 (diff) |
Merge #7889
7889: Make group imports configurable r=lnicola a=asv1
Co-authored-by: asv <[email protected]>
Diffstat (limited to 'crates/ide_assists')
4 files changed, 4 insertions, 4 deletions
diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index dc38f90e9..1422224ac 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs | |||
@@ -99,8 +99,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
99 | format!("Import `{}`", &import), | 99 | format!("Import `{}`", &import), |
100 | range, | 100 | range, |
101 | |builder| { | 101 | |builder| { |
102 | let rewriter = | 102 | let rewriter = insert_use(&scope, mod_path_to_ast(&import), ctx.config.insert_use); |
103 | insert_use(&scope, mod_path_to_ast(&import), ctx.config.insert_use.merge); | ||
104 | builder.rewrite(rewriter); | 103 | builder.rewrite(rewriter); |
105 | }, | 104 | }, |
106 | ); | 105 | ); |
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 5c7678b53..4f0422e96 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 | |||
@@ -154,7 +154,7 @@ fn insert_import( | |||
154 | mod_path.pop_segment(); | 154 | mod_path.pop_segment(); |
155 | mod_path.push_segment(variant_hir_name.clone()); | 155 | mod_path.push_segment(variant_hir_name.clone()); |
156 | let scope = ImportScope::find_insert_use_container(scope_node, &ctx.sema)?; | 156 | let scope = ImportScope::find_insert_use_container(scope_node, &ctx.sema)?; |
157 | *rewriter += insert_use(&scope, mod_path_to_ast(&mod_path), ctx.config.insert_use.merge); | 157 | *rewriter += insert_use(&scope, mod_path_to_ast(&mod_path), ctx.config.insert_use); |
158 | } | 158 | } |
159 | Some(()) | 159 | Some(()) |
160 | } | 160 | } |
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 f3bc6cf39..55481af34 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 | |||
@@ -44,7 +44,7 @@ pub(crate) fn replace_qualified_name_with_use( | |||
44 | let mut rewriter = SyntaxRewriter::default(); | 44 | let mut rewriter = SyntaxRewriter::default(); |
45 | shorten_paths(&mut rewriter, syntax.clone(), &path); | 45 | shorten_paths(&mut rewriter, syntax.clone(), &path); |
46 | if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { | 46 | if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { |
47 | rewriter += insert_use(import_scope, path, ctx.config.insert_use.merge); | 47 | rewriter += insert_use(import_scope, path, ctx.config.insert_use); |
48 | builder.rewrite(rewriter); | 48 | builder.rewrite(rewriter); |
49 | } | 49 | } |
50 | }, | 50 | }, |
diff --git a/crates/ide_assists/src/tests.rs b/crates/ide_assists/src/tests.rs index b7f616760..a7a923beb 100644 --- a/crates/ide_assists/src/tests.rs +++ b/crates/ide_assists/src/tests.rs | |||
@@ -23,6 +23,7 @@ pub(crate) const TEST_CONFIG: AssistConfig = AssistConfig { | |||
23 | insert_use: InsertUseConfig { | 23 | insert_use: InsertUseConfig { |
24 | merge: Some(MergeBehavior::Full), | 24 | merge: Some(MergeBehavior::Full), |
25 | prefix_kind: hir::PrefixKind::Plain, | 25 | prefix_kind: hir::PrefixKind::Plain, |
26 | group: true, | ||
26 | }, | 27 | }, |
27 | }; | 28 | }; |
28 | 29 | ||