mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-12 11:22:18 +00:00
![]() ## Summary fixes: #13813 This PR fixes a bug in the formatting assignment statement when the value is an f-string. This is resolved by using custom best fit layouts if the f-string is (a) not already a flat f-string (thus, cannot be multiline) and (b) is not a multiline string (thus, cannot be flattened). So, it is used in cases like the following: ```py aaaaaaaaaaaaaaaaaa = f"testeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee{ expression}moreeeeeeeeeeeeeeeee" ``` Which is (a) `FStringLayout::Multiline` and (b) not a multiline. There are various other examples in the PR diff along with additional explanation and context as code comments. ## Test Plan Add multiple test cases for various scenarios. |
||
---|---|---|
.. | ||
alias.rs | ||
arguments.rs | ||
bytes_literal.rs | ||
commas.rs | ||
comprehension.rs | ||
decorator.rs | ||
elif_else_clause.rs | ||
except_handler_except_handler.rs | ||
f_string.rs | ||
f_string_element.rs | ||
identifier.rs | ||
keyword.rs | ||
match_case.rs | ||
mod.rs | ||
parameter.rs | ||
parameter_with_default.rs | ||
parameters.rs | ||
string_literal.rs | ||
with_item.rs |