mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
![]() ## Summary We were using `Parenthesize::IfBreaks` universally for `await`, but dropping parentheses can change the AST due to precedence. It turns out that Black's rules aren't _exactly_ the same as operator precedence (e.g., they leave parentheses around `await ([1, 2, 3])`, although they aren't strictly required). Closes https://github.com/astral-sh/ruff/issues/7467. ## Test Plan `cargo test` No change in similarity. Before: | project | similarity index | total files | changed files | |--------------|------------------:|------------------:|------------------:| | cpython | 0.76083 | 1789 | 1632 | | django | 0.99982 | 2760 | 37 | | transformers | 0.99957 | 2587 | 398 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99983 | 3496 | 18 | | warehouse | 0.99929 | 648 | 16 | | zulip | 0.99962 | 1437 | 22 | After: | project | similarity index | total files | changed files | |--------------|------------------:|------------------:|------------------:| | cpython | 0.76083 | 1789 | 1632 | | django | 0.99982 | 2760 | 37 | | transformers | 0.99957 | 2587 | 398 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99983 | 3496 | 18 | | warehouse | 0.99929 | 648 | 16 | | zulip | 0.99962 | 1437 | 22 | |
||
---|---|---|
.. | ||
binary_like.rs | ||
expr_attribute.rs | ||
expr_await.rs | ||
expr_bin_op.rs | ||
expr_bool_op.rs | ||
expr_call.rs | ||
expr_compare.rs | ||
expr_constant.rs | ||
expr_dict.rs | ||
expr_dict_comp.rs | ||
expr_f_string.rs | ||
expr_formatted_value.rs | ||
expr_generator_exp.rs | ||
expr_if_exp.rs | ||
expr_ipy_escape_command.rs | ||
expr_lambda.rs | ||
expr_list.rs | ||
expr_list_comp.rs | ||
expr_name.rs | ||
expr_named_expr.rs | ||
expr_set.rs | ||
expr_set_comp.rs | ||
expr_slice.rs | ||
expr_starred.rs | ||
expr_subscript.rs | ||
expr_tuple.rs | ||
expr_unary_op.rs | ||
expr_yield.rs | ||
expr_yield_from.rs | ||
mod.rs | ||
number.rs | ||
operator.rs | ||
parentheses.rs | ||
string.rs |