diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-16 08:20:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-16 08:20:11 +0000 |
commit | ece626fe81579b6b38cdbd17d3e47bb422360a56 (patch) | |
tree | 3d7936e0c994fbf931085fd7e4dc1eb203d2cb54 /crates/syntax/src/ast | |
parent | eb9ba457b0126bd45c45ef751e92ccfdc5fdc206 (diff) | |
parent | 0f42a71806ad62cd042dd40ab42501180fb72999 (diff) |
Merge #6894
6894: Parenthesize composite if condition before inverting in invert-if assist r=matklad a=Jesse-Bakker
Fixes #6867
Co-authored-by: Jesse Bakker <[email protected]>
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 cc09b77a5..16b079c42 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs | |||
@@ -196,6 +196,9 @@ pub fn expr_method_call(receiver: ast::Expr, method: &str, arg_list: ast::ArgLis | |||
196 | pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr { | 196 | pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr { |
197 | expr_from_text(&if exclusive { format!("&mut {}", expr) } else { format!("&{}", expr) }) | 197 | expr_from_text(&if exclusive { format!("&mut {}", expr) } else { format!("&{}", expr) }) |
198 | } | 198 | } |
199 | pub fn expr_paren(expr: ast::Expr) -> ast::Expr { | ||
200 | expr_from_text(&format!("({})", expr)) | ||
201 | } | ||
199 | fn expr_from_text(text: &str) -> ast::Expr { | 202 | fn expr_from_text(text: &str) -> ast::Expr { |
200 | ast_from_text(&format!("const C: () = {};", text)) | 203 | ast_from_text(&format!("const C: () = {};", text)) |
201 | } | 204 | } |