Stabilize parenthesize_lambda_bodies#22744
Conversation
|
|
@ntBre - we don't run the black compatibility tests against our preview rules, so it looks like some syntax errors slipped past the original implementation. |
Summary -- This PR fixes the issues revealed in #22744 by adding an additional branch to the lambda body formatting that checks if the body `needs_parentheses` before falling back on the `Parentheses::Never` case. I also updated the `ExprNamed::needs_parentheses` implementation to match the one from #8465. Test Plan -- New test based on the failing cases in #22744. I also checked out #22744 and checked that the tests pass after applying the changes from this PR.
Summary -- This PR fixes the issues revealed in #22744 by adding an additional branch to the lambda body formatting that checks if the body `needs_parentheses` before falling back on the `Parentheses::Never` case. I also updated the `ExprNamed::needs_parentheses` implementation to match the one from #8465. Test Plan -- New test based on the failing cases in #22744. I also checked out #22744 and checked that the tests pass after applying the changes from this PR.
e862cb5 to
76c1939
Compare
76c1939 to
bf077c5
Compare
Styles stabilized: - [`avoid_parens_for_long_as_captures`](#22743) - [`remove_parens_around_except_types`](#22741) - [`allow_newline_after_block_open`](#22742) - [`no_chaperone_for_escaped_quote_in_triple_quoted_docstring `](#22739) - [`blank_line_before_decorated_class_in_stub `](#22740) - [`parenthesize_lambda_bodies`](#22744) To-do: - [x] Change target branch to 0.15 release branch - [x] Update documentation - [x] Remove empty commit --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Styles stabilized: - [`avoid_parens_for_long_as_captures`](#22743) - [`remove_parens_around_except_types`](#22741) - [`allow_newline_after_block_open`](#22742) - [`no_chaperone_for_escaped_quote_in_triple_quoted_docstring `](#22739) - [`blank_line_before_decorated_class_in_stub `](#22740) - [`parenthesize_lambda_bodies`](#22744) To-do: - [x] Change target branch to 0.15 release branch - [x] Update documentation - [x] Remove empty commit --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Styles stabilized: - [`avoid_parens_for_long_as_captures`](#22743) - [`remove_parens_around_except_types`](#22741) - [`allow_newline_after_block_open`](#22742) - [`no_chaperone_for_escaped_quote_in_triple_quoted_docstring `](#22739) - [`blank_line_before_decorated_class_in_stub `](#22740) - [`parenthesize_lambda_bodies`](#22744) To-do: - [x] Change target branch to 0.15 release branch - [x] Update documentation - [x] Remove empty commit --------- Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
No description provided.