Inconsistent Struct Body Opening Brace Placement After Where Clause
Open
@jmj0502 is already working on this.
Since Aug 18, 2022.
I-poor-formatting
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
When the body of a struct is empty or it only contains comments, the opening brace of the struct body is placed on the same line as the where clause. If the struct body is not empty, the opening brace is placed on a newline.
No configuration values are needed, and I was using rustfmt 1.5.1-nightly (841b4542 2022-08-17) when I came across this.
Input
struct EmptyBody<T>
where T: Eq {
}
struct LineComment<T>
where T: Eq {
// body
}
struct BlockComment<T>
where T: Eq {
/* block comment */
}
struct HasBody<T>
where T: Eq {
x: T
}
Output
struct EmptyBody<T>
where
T: Eq, {}
struct LineComment<T>
where
T: Eq, {
// body
}
struct BlockComment<T>
where
T: Eq, {/* block comment */}
struct HasBody<T>
where
T: Eq,
{
x: T,
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.