Skip to content

Add a canonical rustfmt config #86

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

Merged
merged 4 commits into from
Mar 13, 2025
Merged
Changes from all commits
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
17 changes: 16 additions & 1 deletion content/wiki/formatting_scheme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,24 @@ 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

# Commented out because it is still unstable, but works fine in practice.
# imports_granularity = "Module"

# END LINEBENDER RUSTFMT CONFIG
```

## Markdown

In Markdown files, every paragraph should have one line per sentence.
This makes git diff easier to read.
[[1]](https://nick.groenen.me/notes/one-sentence-per-line/) [[2]](https://sive.rs/1s)