diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs index 4972085d693..97ac6b8322b 100644 --- a/crates/assists/src/utils/insert_use.rs +++ b/crates/assists/src/utils/insert_use.rs @@ -233,15 +233,7 @@ fn recursive_merge( None, false, ); - use_trees.insert( - idx, - make::use_tree( - make::path_unqualified(make::path_segment_self()), - None, - None, - true, - ), - ); + use_trees.insert(idx, make::glob_use_tree()); continue; } } @@ -806,14 +798,14 @@ use std::io;", check_full( "token::TokenKind", r"use token::TokenKind::*;", - r"use token::TokenKind::{self::*, self};", + r"use token::TokenKind::{*, self};", ) // FIXME: have it emit `use token::TokenKind::{self, *}`? } #[test] fn merge_self_glob() { - check_full("self", r"use self::*;", r"use self::{self::*, self};") + check_full("self", r"use self::*;", r"use self::{*, self};") // FIXME: have it emit `use {self, *}`? } diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 25e8a359d9e..6868feed997 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 { ast_from_text(text) } +pub fn glob_use_tree() -> ast::UseTree { + ast_from_text("use *;") +} + pub fn use_tree( path: ast::Path, use_tree_list: Option,