Format BoolOp (#4986)

This commit is contained in:
Micha Reiser 2023-06-21 11:27:57 +02:00 committed by GitHub
parent db301c14bd
commit 653dbb6d17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 804 additions and 446 deletions

View file

@ -7,6 +7,7 @@ use ruff_formatter::{
};
use rustpython_parser::ast::Expr;
mod binary_like;
pub(crate) mod expr_attribute;
pub(crate) mod expr_await;
pub(crate) mod expr_bin_op;
@ -59,7 +60,7 @@ impl FormatRule<Expr, PyFormatContext<'_>> for FormatExpr {
);
let format_expr = format_with(|f| match item {
Expr::BoolOp(expr) => expr.format().fmt(f),
Expr::BoolOp(expr) => expr.format().with_options(Some(parentheses)).fmt(f),
Expr::NamedExpr(expr) => expr.format().fmt(f),
Expr::BinOp(expr) => expr.format().with_options(Some(parentheses)).fmt(f),
Expr::UnaryOp(expr) => expr.format().fmt(f),