)
}
+ #[test]
+ fn invert_if_remove_not_parentheses() {
+ check_assist(
+ invert_if,
+ "fn f() { i<|>f !(x == 3 || x == 4 || x == 5) { 3 * 2 } else { 1 } }",
+ "fn f() { if x == 3 || x == 4 || x == 5 { 1 } else { 3 * 2 } }",
+ )
+ }
+
#[test]
fn invert_if_remove_inequality() {
check_assist(
};
Some(make::expr_method_call(receiver, method, arg_list))
}
- ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::PrefixOp::Not => pe.expr(),
+ ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::PrefixOp::Not => {
+ if let ast::Expr::ParenExpr(parexpr) = pe.expr()? {
+ parexpr.expr()
+ } else {
+ pe.expr()
+ }
+ }
// FIXME:
// ast::Expr::Literal(true | false )
_ => None,