diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-06 15:21:05 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-06 15:21:05 +0100 |
commit | 81d6816f175e02bccef8f373d2961d756dff31bb (patch) | |
tree | 5c1a042a4c4e77475e7bac3ea1b5ac96ff457377 /crates/assists/src/handlers/auto_import.rs | |
parent | 8bf13292f0af1cfd74a6123399f524c81dcb57e3 (diff) | |
parent | 2090b534fc249a493823bb8e9039c0123aa0b90e (diff) |
Merge #6150
6150: Move ModPath->ast::Path function to IDE layer r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/auto_import.rs')
-rw-r--r-- | crates/assists/src/handlers/auto_import.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/assists/src/handlers/auto_import.rs b/crates/assists/src/handlers/auto_import.rs index 357ff6392..d3ee98e5f 100644 --- a/crates/assists/src/handlers/auto_import.rs +++ b/crates/assists/src/handlers/auto_import.rs | |||
@@ -13,7 +13,10 @@ use syntax::{ | |||
13 | SyntaxNode, | 13 | SyntaxNode, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | use crate::{utils::insert_use, AssistContext, AssistId, AssistKind, Assists, GroupLabel}; | 16 | use crate::{ |
17 | utils::insert_use, utils::mod_path_to_ast, AssistContext, AssistId, AssistKind, Assists, | ||
18 | GroupLabel, | ||
19 | }; | ||
17 | 20 | ||
18 | // Assist: auto_import | 21 | // Assist: auto_import |
19 | // | 22 | // |
@@ -54,7 +57,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
54 | range, | 57 | range, |
55 | |builder| { | 58 | |builder| { |
56 | let new_syntax = | 59 | let new_syntax = |
57 | insert_use(&scope, import.to_ast_path(), ctx.config.insert_use.merge); | 60 | insert_use(&scope, mod_path_to_ast(&import), ctx.config.insert_use.merge); |
58 | builder.replace(syntax.text_range(), new_syntax.to_string()) | 61 | builder.replace(syntax.text_range(), new_syntax.to_string()) |
59 | }, | 62 | }, |
60 | ); | 63 | ); |