From 9eb19d92dd8d3200f3530faefa7a4048f58d280d Mon Sep 17 00:00:00 2001 From: Vladyslav Katasonov Date: Wed, 10 Feb 2021 19:26:42 +0300 Subject: allow try expr? when extacting function --- crates/syntax/src/ast/make.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 5f6b96c23..5eee33545 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -200,6 +200,9 @@ pub fn expr_return(expr: Option) -> ast::Expr { None => expr_from_text("return"), } } +pub fn expr_try(expr: ast::Expr) -> ast::Expr { + expr_from_text(&format!("{}?", expr)) +} pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr { expr_from_text(&format!("match {} {}", expr, match_arm_list)) } -- cgit v1.2.3