diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index bdaecdc43..2304e00cf 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -302,9 +302,10 @@ impl ast::UseTree { | |||
302 | Some(it) => it, | 302 | Some(it) => it, |
303 | None => return self.clone(), | 303 | None => return self.clone(), |
304 | }; | 304 | }; |
305 | let use_tree = make::use_tree(suffix.clone(), self.use_tree_list(), self.alias()); | 305 | let use_tree = |
306 | make::use_tree(suffix.clone(), self.use_tree_list(), self.alias(), self.has_star()); | ||
306 | let nested = make::use_tree_list(iter::once(use_tree)); | 307 | let nested = make::use_tree_list(iter::once(use_tree)); |
307 | return make::use_tree(prefix.clone(), Some(nested), None); | 308 | return make::use_tree(prefix.clone(), Some(nested), None, false); |
308 | 309 | ||
309 | fn split_path_prefix(prefix: &ast::Path) -> Option<ast::Path> { | 310 | fn split_path_prefix(prefix: &ast::Path) -> Option<ast::Path> { |
310 | let parent = prefix.parent_path()?; | 311 | let parent = prefix.parent_path()?; |
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 4621c9888..dbf8e6370 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -29,12 +29,17 @@ pub fn use_tree( | |||
29 | path: ast::Path, | 29 | path: ast::Path, |
30 | use_tree_list: Option<ast::UseTreeList>, | 30 | use_tree_list: Option<ast::UseTreeList>, |
31 | alias: Option<ast::Alias>, | 31 | alias: Option<ast::Alias>, |
32 | add_star: bool, | ||
32 | ) -> ast::UseTree { | 33 | ) -> ast::UseTree { |
33 | let mut buf = "use ".to_string(); | 34 | let mut buf = "use ".to_string(); |
34 | buf += &path.syntax().to_string(); | 35 | buf += &path.syntax().to_string(); |
35 | if let Some(use_tree_list) = use_tree_list { | 36 | if let Some(use_tree_list) = use_tree_list { |
36 | buf += &format!("::{}", use_tree_list); | 37 | buf += &format!("::{}", use_tree_list); |
37 | } | 38 | } |
39 | if add_star { | ||
40 | buf += "::*"; | ||
41 | } | ||
42 | |||
38 | if let Some(alias) = alias { | 43 | if let Some(alias) = alias { |
39 | buf += &format!(" {}", alias); | 44 | buf += &format!(" {}", alias); |
40 | } | 45 | } |