Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions content/wiki/formatting_scheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +34 to +35
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Fair. I don't care that much either way.

Copy link
Member

Choose a reason for hiding this comment

The 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.
Expand Down
Loading