From be688ece7b694f0d2756857bf73789b86da6b25d Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 16 Jan 2025 15:36:11 +0100 Subject: [PATCH 1/4] 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/4] 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 ``` From 797385d4e7e389c504e8b578c59a085351b4ef29 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:13:03 +0000 Subject: [PATCH 3/4] Remove `single_line_let_else_max_width` We can always add it back later --- content/wiki/formatting_scheme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/content/wiki/formatting_scheme.md b/content/wiki/formatting_scheme.md index 4b5f8ed..c54c35d 100644 --- a/content/wiki/formatting_scheme.md +++ b/content/wiki/formatting_scheme.md @@ -31,8 +31,6 @@ 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 # Commented out because it is still unstable, but works fine in practice. # imports_granularity = "Module" From 116e19c6bd318eb252dbce537f75ebed0df0331b Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:14:43 +0000 Subject: [PATCH 4/4] Remove trailing blank line --- content/wiki/formatting_scheme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/wiki/formatting_scheme.md b/content/wiki/formatting_scheme.md index c54c35d..91cf0c2 100644 --- a/content/wiki/formatting_scheme.md +++ b/content/wiki/formatting_scheme.md @@ -42,4 +42,3 @@ use_field_init_shorthand = true 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) -