3493: make::use_item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-03-06 14:56:52 +00:00 committed by GitHub
commit 4173645a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,10 @@ pub fn use_tree_list(use_trees: impl IntoIterator<Item = ast::UseTree>) -> ast::
ast_from_text(&format!("use {{{}}};", use_trees)) ast_from_text(&format!("use {{{}}};", use_trees))
} }
pub fn use_item(use_tree: ast::UseTree) -> ast::UseItem {
ast_from_text(&format!("use {};", use_tree.syntax()))
}
pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField { pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField {
return match expr { return match expr {
Some(expr) => from_text(&format!("{}: {}", name.syntax(), expr.syntax())), Some(expr) => from_text(&format!("{}: {}", name.syntax(), expr.syntax())),