diff options
author | Vladyslav Katasonov <[email protected]> | 2021-02-10 16:26:42 +0000 |
---|---|---|
committer | Vladyslav Katasonov <[email protected]> | 2021-02-13 19:04:52 +0000 |
commit | 9eb19d92dd8d3200f3530faefa7a4048f58d280d (patch) | |
tree | 2414b2478255d2856ccffb168e6092145bde8fbd /crates/syntax/src/ast | |
parent | f345d1772ab3827fbc3e31428b0d9479cab0ea39 (diff) |
allow try expr? when extacting function
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r-- | crates/syntax/src/ast/make.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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>) -> ast::Expr { | |||
200 | None => expr_from_text("return"), | 200 | None => expr_from_text("return"), |
201 | } | 201 | } |
202 | } | 202 | } |
203 | pub fn expr_try(expr: ast::Expr) -> ast::Expr { | ||
204 | expr_from_text(&format!("{}?", expr)) | ||
205 | } | ||
203 | pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr { | 206 | pub fn expr_match(expr: ast::Expr, match_arm_list: ast::MatchArmList) -> ast::Expr { |
204 | expr_from_text(&format!("match {} {}", expr, match_arm_list)) | 207 | expr_from_text(&format!("match {} {}", expr, match_arm_list)) |
205 | } | 208 | } |