From a3a722de9ffaefdd0a46194e7ea2edac9754fd38 Mon Sep 17 00:00:00 2001 From: unexge Date: Fri, 15 Jan 2021 22:14:51 +0300 Subject: Add Unmerge Use assist --- crates/syntax/src/ast/make.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 1ed8a96e5..9ffc3ae11 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -108,8 +108,12 @@ pub fn use_tree_list(use_trees: impl IntoIterator) -> ast:: ast_from_text(&format!("use {{{}}};", use_trees)) } -pub fn use_(use_tree: ast::UseTree) -> ast::Use { - ast_from_text(&format!("use {};", use_tree)) +pub fn use_(visibility: Option, use_tree: ast::UseTree) -> ast::Use { + let visibility = match visibility { + None => String::new(), + Some(it) => format!("{} ", it), + }; + ast_from_text(&format!("{}use {};", visibility, use_tree)) } pub fn record_expr_field(name: ast::NameRef, expr: Option) -> ast::RecordExprField { -- cgit v1.2.3