mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:47 +00:00
Create dedicated is_*_enabled
functions for each preview style (#8988)
This commit is contained in:
parent
7e390d3772
commit
0bda1913d1
7 changed files with 39 additions and 11 deletions
|
@ -3,7 +3,7 @@ use std::ops::{Deref, Index};
|
|||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use ruff_formatter::{write, FormatContext};
|
||||
use ruff_formatter::write;
|
||||
use ruff_python_ast::{
|
||||
Expr, ExprAttribute, ExprBinOp, ExprBoolOp, ExprCompare, ExprUnaryOp, UnaryOp,
|
||||
};
|
||||
|
@ -21,6 +21,7 @@ use crate::expression::parentheses::{
|
|||
use crate::expression::string::{AnyString, FormatString, StringLayout};
|
||||
use crate::expression::OperatorPrecedence;
|
||||
use crate::prelude::*;
|
||||
use crate::preview::is_fix_power_op_line_length_enabled;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub(super) enum BinaryLike<'a> {
|
||||
|
@ -719,7 +720,7 @@ impl Format<PyFormatContext<'_>> for FlatBinaryExpressionSlice<'_> {
|
|||
{
|
||||
hard_line_break().fmt(f)?;
|
||||
} else if is_pow {
|
||||
if f.context().options().preview().is_enabled() {
|
||||
if is_fix_power_op_line_length_enabled(f.context()) {
|
||||
in_parentheses_only_if_group_breaks(&space()).fmt(f)?;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue