Fix merge-imports assist for wildcard imports

This commit is contained in:
Piotr Szpetkowski 2020-03-27 17:28:25 +01:00
parent 75f6ab208a
commit f016d8b900
No known key found for this signature in database
GPG key ID: D3FEC6AE666BC5B1
3 changed files with 36 additions and 2 deletions

View file

@ -29,12 +29,17 @@ pub fn use_tree(
path: ast::Path,
use_tree_list: Option<ast::UseTreeList>,
alias: Option<ast::Alias>,
add_star: bool,
) -> ast::UseTree {
let mut buf = "use ".to_string();
buf += &path.syntax().to_string();
if let Some(use_tree_list) = use_tree_list {
buf += &format!("::{}", use_tree_list);
}
if add_star {
buf += "::*";
}
if let Some(alias) = alias {
buf += &format!(" {}", alias);
}