-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a canonical rustfmt config #86
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,21 @@ Shaders are usually licensed under the former two licenses OR the Unlicense. | |
Most Linebender projects files are written in Rust. | ||
For those files, the formatting produced by `rustfmt` is required. | ||
|
||
The following rustfmt config is recommended: | ||
|
||
```toml | ||
# LINEBENDER RUSTFMT CONFIG - v1 | ||
# Ensure lines end with \n even if the git configuration core.autocrlf is not set to true | ||
newline_style = "Unix" | ||
|
||
# `Foobar { foo, bar }` is more readable than `Foo { foo: foo, bar: bar }` | ||
use_field_init_shorthand = true | ||
|
||
# Forces let else blocks to always be their own line(s) | ||
single_line_let_else_max_width = 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Obviously this isn't used at all in Linebender yet. This is a reasonable value, but I'd lean more towards keeping the default without very good reason, for consistency with the rest of the ecosystem. This is certainly more taste based than the other two options here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what it's worth I copy-pasted it from the xilem repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. Fair. I don't care that much either way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we approved it in xilem#305. What I said back then still applies for me: it's quite minor and so I don't personally care much either way. I believe this was originally added by you @PoignardAzur. So if you still think it's worth having, then I'm fine with it and don't want to bikeshed it. However, if you're not arguing for its benefit, then I don't think we have anyone doing that and we should omit it by default as Daniel mentioned. |
||
# END LINEBENDER RUSTFMT CONFIG | ||
xStrom marked this conversation as resolved.
Show resolved
Hide resolved
PoignardAzur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
## Markdown | ||
|
||
In Markdown files, every paragraph should have one line per sentence. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do decide to set this, I'd expect it to have the same value as
single_line_if_else_max_width
, I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, they seem very similar and have identical default values.