From 96e3f6982eb713bf90a7519a571038f683b4bdc3 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 5 Jul 2024 22:40:41 +0200 Subject: [PATCH] add rustfmt.toml --- rustfmt.toml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..62f400e --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,38 @@ +edition = "2021" +max_width = 90 +newline_style = "Unix" +unstable_features = true + +# skip generated files +format_generated_files = false + +# always use tabs. +hard_tabs = true +tab_spaces = 4 + +# commas inbetween but not after +match_block_trailing_comma = true +trailing_comma = "Never" + +# fix my imports for me +imports_granularity = "Crate" +#group_imports = "One" + +# format everything +format_code_in_doc_comments = true +format_macro_matchers = true + +# don't keep outdated syntax +use_field_init_shorthand = true +use_try_shorthand = true + +# condense Struct { _, _ } to Struct { .. } +condense_wildcard_suffixes = true + +# prefer foo(Bar { \n }) over foo(\nBar { \n }\n) +overflow_delimited_expr = true + +# I wish there was a way to allow 0..n but not a + 1..b + 2 +# However, the later looks so terible that I use spaces everywhere +# https://github.com/rust-lang/rustfmt/issues/3367 +spaces_around_ranges = true