about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-13 09:16:09 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-07-29 08:26:08 +1000
commit118f9350c5b902e462a6dcc4325670f3da701600 (patch)
tree56378423cd483dd17e16fc47fc9541c5335a3c57
parent2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b (diff)
downloadrust-118f9350c5b902e462a6dcc4325670f3da701600.tar.gz
rust-118f9350c5b902e462a6dcc4325670f3da701600.zip
Update `use` declarations formatting options.
As decided in rust-lang/compiler-team#750.

Use declarations are currently wildly inconsistent because rustfmt is
quite unopinionated about how they should be formatted. The
`rustfmt.toml` additions makes rustfmt more opinionated, which avoids
the need for any decision when adding new use declarations to a file.

This commit only updates `rustfmt.toml` and
`compiler/rustc_codegen_cranelift/rustfmt.toml`. The next commit will do
the reformatting.
-rw-r--r--compiler/rustc_codegen_cranelift/rustfmt.toml2
-rw-r--r--rustfmt.toml2
2 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/rustfmt.toml b/compiler/rustc_codegen_cranelift/rustfmt.toml
index 6f4d4413c25..d9e6ac3d543 100644
--- a/compiler/rustc_codegen_cranelift/rustfmt.toml
+++ b/compiler/rustc_codegen_cranelift/rustfmt.toml
@@ -6,3 +6,5 @@ ignore = [
 version = "Two"
 use_small_heuristics = "Max"
 merge_derives = false
+group_imports = "StdExternalCrate"
+imports_granularity = "Module"
diff --git a/rustfmt.toml b/rustfmt.toml
index 8c1d3b94f19..5aafb83b2bc 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -2,6 +2,8 @@
 version = "Two"
 use_small_heuristics = "Max"
 merge_derives = false
+group_imports = "StdExternalCrate"
+imports_granularity = "Module"
 
 # Files to ignore. Each entry uses gitignore syntax, but `!` prefixes aren't allowed.
 ignore = [