diff options
Diffstat (limited to 'crates/ide_db/src/helpers')
-rw-r--r-- | crates/ide_db/src/helpers/insert_use.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ide_db/src/helpers/insert_use.rs b/crates/ide_db/src/helpers/insert_use.rs index 9e0cb91c3..20c195f82 100644 --- a/crates/ide_db/src/helpers/insert_use.rs +++ b/crates/ide_db/src/helpers/insert_use.rs | |||
@@ -14,10 +14,12 @@ use syntax::{ | |||
14 | AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, | 14 | AstToken, InsertPosition, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken, |
15 | }; | 15 | }; |
16 | 16 | ||
17 | pub use hir::PrefixKind; | ||
18 | |||
17 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | 19 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
18 | pub struct InsertUseConfig { | 20 | pub struct InsertUseConfig { |
19 | pub merge: Option<MergeBehavior>, | 21 | pub merge: Option<MergeBehavior>, |
20 | pub prefix_kind: hir::PrefixKind, | 22 | pub prefix_kind: PrefixKind, |
21 | pub group: bool, | 23 | pub group: bool, |
22 | } | 24 | } |
23 | 25 | ||
@@ -211,7 +213,7 @@ pub fn try_merge_imports( | |||
211 | let lhs_tree = lhs.use_tree()?; | 213 | let lhs_tree = lhs.use_tree()?; |
212 | let rhs_tree = rhs.use_tree()?; | 214 | let rhs_tree = rhs.use_tree()?; |
213 | let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behavior)?; | 215 | let merged = try_merge_trees(&lhs_tree, &rhs_tree, merge_behavior)?; |
214 | Some(lhs.with_use_tree(merged)) | 216 | Some(lhs.with_use_tree(merged).clone_for_update()) |
215 | } | 217 | } |
216 | 218 | ||
217 | pub fn try_merge_trees( | 219 | pub fn try_merge_trees( |
@@ -232,7 +234,7 @@ pub fn try_merge_trees( | |||
232 | } else { | 234 | } else { |
233 | (lhs.split_prefix(&lhs_prefix), rhs.split_prefix(&rhs_prefix)) | 235 | (lhs.split_prefix(&lhs_prefix), rhs.split_prefix(&rhs_prefix)) |
234 | }; | 236 | }; |
235 | recursive_merge(&lhs, &rhs, merge) | 237 | recursive_merge(&lhs, &rhs, merge).map(|it| it.clone_for_update()) |
236 | } | 238 | } |
237 | 239 | ||
238 | /// Recursively "zips" together lhs and rhs. | 240 | /// Recursively "zips" together lhs and rhs. |