Open ytmimi opened 2 months ago
Just as a reference to another section of the guide that may be operative here: https://doc.rust-lang.org/nightly/style-guide/types.html#line-breaks
this was the sole topic we discussed in the t-style meeting today and it was one we discussed at length
Given the pending deadlines for the 2024 Edition work, our position is that for now, the second example:
type AAAAAAAAAAAAA: BBBBBBBBBBBBBBB<
CCCCCCCCCCCCCCCCC,
DDDDDDDDDDDDDDDDD,
EEEEEEEEEEEEEEEEE,
FFFFFFFFFFFFFFFFF,
GGGGGGGGGGGGGGGGG,
HHHHHHHHHHHHHHHHH,
IIIIIIIIIIIIIIIII,
>;
can be considered correct and we're pleased that the formatting is no longer dependent upon the presence/absence of additional bounds (as it was in 2021 and below style editions)
based on the discussion though, it's very conceivable that we'd want to do something different for the next style edition so because of that as well as the desire to start freezing the 2024 edition, we're not going to update the style guide text at this time
please feel free to weigh in and correct me @rust-lang/style but wanted to post a summary to unlock the rustfmt team
This is related to https://github.com/rust-lang/rustfmt/issues/5892. To summarize, there are inconsistencies when formatting Type Alias Bounds with rustfmt when using different
style_edition
values.Using
style_edition={2015|2018|2021}
produces the following output:and using
style_edition=2024
produces the following output:The Type Alias Section of the Style Guide, doesn't give any prescription for how to break or handle the indentation of the bounds.
In https://github.com/rust-lang/rustfmt/pull/6293, it was suggested that the Type Alias Bounds should be similar to those for Trait Bounds, and therefore produce the following formatting:
So I'm wondering what the correct formatting should be, and if the Style Guide should be updated to provide clearer guidance on this.
Another question I have is how should Type Alias Bounds be formatted in this following case: