From a898752881779a328462ad9f2db291073f2f134f Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 12 Sep 2020 19:18:14 +0200 Subject: Reimplement import merging by making it recursive properly nesting all levels --- crates/syntax/src/ast/edit.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/syntax') diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 8b1c65dd6..45cf31f13 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs @@ -347,6 +347,7 @@ impl ast::UseTree { self.clone() } + /// Splits off the given prefix, making it the path component of the use tree, appending the rest of the path to all UseTreeList items. #[must_use] pub fn split_prefix(&self, prefix: &ast::Path) -> ast::UseTree { let suffix = if self.path().as_ref() == Some(prefix) && self.use_tree_list().is_none() { -- cgit v1.2.3 From 45298b5d2a8e7d1f962f3117de27957e393c03e2 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 16 Sep 2020 20:33:08 +0200 Subject: Add make::glob_use_tree function to create star-only UseTree --- crates/syntax/src/ast/make.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/syntax') 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 { 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, -- cgit v1.2.3