1# Run rustfmt with this config (it should be picked up automatically).
2style_edition = "2024"
3use_small_heuristics = "Max"
4merge_derives = false
5group_imports = "StdExternalCrate"
6imports_granularity = "Module"
7use_field_init_shorthand = true
8
9# Files to ignore. Each entry uses gitignore syntax, but `!` prefixes aren't allowed.
10ignore = [
11 "/build/",
12 "/*-build/",
13 "/build-*/",
14 "/vendor/",
15
16 # Some tests are not formatted, for various reasons.
17 "/tests/codegen-llvm/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted.
18 "/tests/crashes/", # Many of these tests contain syntax errors.
19 "/tests/debuginfo/", # These tests are somewhat sensitive to source code layout.
20 "/tests/incremental/", # These tests are somewhat sensitive to source code layout.
21 "/tests/pretty/", # These tests are very sensitive to source code layout.
22 "/tests/run-make/export", # These tests contain syntax errors.
23 "/tests/rustdoc-html/", # Some have syntax errors, some are whitespace-sensitive.
24 "/tests/rustdoc-gui/", # Some tests are sensitive to source code layout.
25 "/tests/rustdoc-ui/", # Some have syntax errors, some are whitespace-sensitive.
26 "/tests/ui/", # Some have syntax errors, some are whitespace-sensitive.
27 "/tests/ui-fulldeps/", # Some are whitespace-sensitive (e.g. `// ~ERROR` comments).
28
29 # Do not format submodules.
30 "library/backtrace",
31 "library/compiler-builtins",
32 "library/portable-simd",
33 "library/stdarch",
34 "src/doc/book",
35 "src/doc/edition-guide",
36 "src/doc/embedded-book",
37 "src/doc/nomicon",
38 "src/doc/reference",
39 "src/doc/rust-by-example",
40 "src/doc/rustc-dev-guide",
41 "src/llvm-project",
42 "src/tools/cargo",
43 "src/tools/clippy",
44 "src/tools/enzyme",
45 "src/tools/miri",
46 "src/tools/rust-analyzer",
47 "src/tools/rustc-perf",
48 "src/tools/rustfmt",
49 "src/gcc",
50
51 # These are ignored by a standard cargo fmt run.
52 "compiler/rustc_codegen_cranelift/scripts",
53 "compiler/rustc_codegen_gcc/tests",
54 # Code automatically generated and included.
55 "compiler/rustc_codegen_gcc/src/intrinsic/archs.rs",
56 "compiler/rustc_codegen_gcc/example",
57]