rustfmt
rustfmt copied to clipboard
Adjust rhs shape width to account for next line indentation
Fixes #5321
Previously the Shape
returned from expr::shape_from_rhs_tactic
would always return a Shape
with a width
== config.max_width
when the rhs_tactic
was RhsTactics::ForceNextLineWithoutIndent
and the
indentation was 0. For example, when rewriting generic trait bounds at the top level of a file.
In this case, trait bounds that were between (max_width
- tab_spaces
) and max_width
, would be considered properly formatted and wouldn't wrap.
Now, the shape takes into account the whitespace to properly wrap when the max_width
is exceeded.
Need to think on this for a bit to determine whether it meets the criteria of a true bug or if it's at risk of violating our stability guarantee and would need to be gated. It's likely going to end up being the latter even though there's a reasonable case to be made for the former
@calebcartwright I went ahead and version gated the changes. If we decide that It doesn't need to be version gated it should be easy to revert the 2nd commit.