From be688ece7b694f0d2756857bf73789b86da6b25d Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 16 Jan 2025 15:36:11 +0100 Subject: [PATCH 1/2] Add a canonical rustfmt config --- content/wiki/formatting_scheme.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/wiki/formatting_scheme.md b/content/wiki/formatting_scheme.md index e0e1ad5..c464d61 100644 --- a/content/wiki/formatting_scheme.md +++ b/content/wiki/formatting_scheme.md @@ -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 +# END LINEBENDER RUSTFMT CONFIG +``` + ## Markdown In Markdown files, every paragraph should have one line per sentence. From d8678569762c14ef486e9689d33609477bdc38d7 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 23 Jan 2025 17:57:41 +0000 Subject: [PATCH 2/2] Update content/wiki/formatting_scheme.md Co-authored-by: Kaur Kuut --- content/wiki/formatting_scheme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/wiki/formatting_scheme.md b/content/wiki/formatting_scheme.md index c464d61..4b5f8ed 100644 --- a/content/wiki/formatting_scheme.md +++ b/content/wiki/formatting_scheme.md @@ -33,6 +33,9 @@ use_field_init_shorthand = true # Forces let else blocks to always be their own line(s) single_line_let_else_max_width = 0 +# Commented out because it is still unstable, but works fine in practice. +# imports_granularity = "Module" + # END LINEBENDER RUSTFMT CONFIG ```