diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-15 19:43:59 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-15 19:43:59 +0000 |
commit | d93d3d6d7334bc94bdbfe9f3ab50cafd0113211e (patch) | |
tree | 5bd9f3c17f87851325565c3fb0aa698d5583f62c /crates/syntax/src | |
parent | 8a869e870ac6328967fb120a0ebe44a9c900eaf0 (diff) | |
parent | c303014f3923e46ae63fbcdc6cf6f166bb040b1e (diff) |
Merge #7289
7289: Add Unmerge Use assist r=matklad a=unexge
Closes https://github.com/rust-analyzer/rust-analyzer/issues/7185
Co-authored-by: unexge <[email protected]>
Diffstat (limited to 'crates/syntax/src')
-rw-r--r-- | crates/syntax/src/ast/make.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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<Item = ast::UseTree>) -> ast:: | |||
108 | ast_from_text(&format!("use {{{}}};", use_trees)) | 108 | ast_from_text(&format!("use {{{}}};", use_trees)) |
109 | } | 109 | } |
110 | 110 | ||
111 | pub fn use_(use_tree: ast::UseTree) -> ast::Use { | 111 | pub fn use_(visibility: Option<ast::Visibility>, use_tree: ast::UseTree) -> ast::Use { |
112 | ast_from_text(&format!("use {};", use_tree)) | 112 | let visibility = match visibility { |
113 | None => String::new(), | ||
114 | Some(it) => format!("{} ", it), | ||
115 | }; | ||
116 | ast_from_text(&format!("{}use {};", visibility, use_tree)) | ||
113 | } | 117 | } |
114 | 118 | ||
115 | pub fn record_expr_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField { | 119 | pub fn record_expr_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField { |