1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Formatting rules. The same file is kept in every project.
#
# Everything here is applied by the stable rustfmt, so `cargo fmt` and
# `rust-format.sh -p <crate>` produce the same result and no nightly toolchain
# is involved.
# Language and style edition
= "2024" # Parse as Rust 2024 when rustfmt runs outside Cargo
= "2024" # 2024 style rules, stated rather than inherited from `edition`
# Whitespace
= "Unix" # LF everywhere; the tree is shared with Linux and FreeBSD hosts
= false # Indent with spaces
= 4
# Width
= 80
= "Max" # Short constructs may use the whole line before they break
# Functions
= "Vertical" # One parameter per line as soon as there is more than one
= true # Always name the ABI: `extern "C"`, never a bare `extern`
# Shorthands
= true # `Point { x, y }`, not `Point { x: x, y: y }`
= true # `expr?`, not `try!(expr)`
# Literals
= "Lower" # `0xff`, not `0xFF`
# Imports
= true # Sort imports within each group
# Not set: rustfmt applies these only on a nightly toolchain, and none is
# installed. Until 2026-10-04 this file carried them, so older code has no
# trailing commas and one `use` per module; rustfmt now adds the commas and
# leaves import grouping as it finds it.
#
# trailing_comma, imports_granularity, group_imports, reorder_impl_items,
# wrap_comments, format_code_in_doc_comments, normalize_doc_attributes,
# format_macro_matchers, condense_wildcard_suffixes,
# struct_field_align_threshold, enum_discrim_align_threshold