aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/utils/insert_use.rs14
-rw-r--r--crates/syntax/src/ast/make.rs4
2 files changed, 7 insertions, 11 deletions
diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs
index 4972085d6..97ac6b832 100644
--- a/crates/assists/src/utils/insert_use.rs
+++ b/crates/assists/src/utils/insert_use.rs
@@ -233,15 +233,7 @@ fn recursive_merge(
233 None, 233 None,
234 false, 234 false,
235 ); 235 );
236 use_trees.insert( 236 use_trees.insert(idx, make::glob_use_tree());
237 idx,
238 make::use_tree(
239 make::path_unqualified(make::path_segment_self()),
240 None,
241 None,
242 true,
243 ),
244 );
245 continue; 237 continue;
246 } 238 }
247 } 239 }
@@ -806,14 +798,14 @@ use std::io;",
806 check_full( 798 check_full(
807 "token::TokenKind", 799 "token::TokenKind",
808 r"use token::TokenKind::*;", 800 r"use token::TokenKind::*;",
809 r"use token::TokenKind::{self::*, self};", 801 r"use token::TokenKind::{*, self};",
810 ) 802 )
811 // FIXME: have it emit `use token::TokenKind::{self, *}`? 803 // FIXME: have it emit `use token::TokenKind::{self, *}`?
812 } 804 }
813 805
814 #[test] 806 #[test]
815 fn merge_self_glob() { 807 fn merge_self_glob() {
816 check_full("self", r"use self::*;", r"use self::{self::*, self};") 808 check_full("self", r"use self::*;", r"use self::{*, self};")
817 // FIXME: have it emit `use {self, *}`? 809 // FIXME: have it emit `use {self, *}`?
818 } 810 }
819 811
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index 25e8a359d..6868feed9 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -38,6 +38,10 @@ pub fn path_from_text(text: &str) -> ast::Path {
38 ast_from_text(text) 38 ast_from_text(text)
39} 39}
40 40
41pub fn glob_use_tree() -> ast::UseTree {
42 ast_from_text("use *;")
43}
44
41pub fn use_tree( 45pub fn use_tree(
42 path: ast::Path, 46 path: ast::Path,
43 use_tree_list: Option<ast::UseTreeList>, 47 use_tree_list: Option<ast::UseTreeList>,