mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-19 01:50:32 +00:00
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 <github@jessebakker.com>
This commit is contained in:
commit
ece626fe81
3 changed files with 16 additions and 0 deletions
|
@ -196,6 +196,9 @@ pub fn expr_method_call(receiver: ast::Expr, method: &str, arg_list: ast::ArgLis
|
|||
pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr {
|
||||
expr_from_text(&if exclusive { format!("&mut {}", expr) } else { format!("&{}", expr) })
|
||||
}
|
||||
pub fn expr_paren(expr: ast::Expr) -> ast::Expr {
|
||||
expr_from_text(&format!("({})", expr))
|
||||
}
|
||||
fn expr_from_text(text: &str) -> ast::Expr {
|
||||
ast_from_text(&format!("const C: () = {};", text))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue