mirror of
https://github.com/astral-sh/ruff
synced 2026-01-22 05:51:03 -05:00
Pass parent to NeedsParentheses (#5708)
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
use crate::context::PyFormatContext;
|
||||
use crate::expression::parentheses::{
|
||||
default_expression_needs_parentheses, NeedsParentheses, Parentheses, Parenthesize,
|
||||
};
|
||||
use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};
|
||||
use crate::{not_yet_implemented_custom_text, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
use rustpython_parser::ast::ExprLambda;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -23,9 +22,9 @@ impl FormatNodeRule<ExprLambda> for FormatExprLambda {
|
||||
impl NeedsParentheses for ExprLambda {
|
||||
fn needs_parentheses(
|
||||
&self,
|
||||
parenthesize: Parenthesize,
|
||||
context: &PyFormatContext,
|
||||
) -> Parentheses {
|
||||
default_expression_needs_parentheses(self.into(), parenthesize, context)
|
||||
_parent: AnyNodeRef,
|
||||
_context: &PyFormatContext,
|
||||
) -> OptionalParentheses {
|
||||
OptionalParentheses::Multiline
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user