-
Notifications
You must be signed in to change notification settings - Fork 0
/
rustfmt.toml
50 lines (41 loc) · 1.69 KB
/
rustfmt.toml
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
43
44
45
46
47
48
49
50
# use nightly toolchain, e.g.:
#
# rustup component add rustfmt --toolchain nightly
# cargo +nightly fmt
#
# for VSCode, add the following to settings.json:
# "rust-analyzer.rustfmt.extraArgs": [ "+nightly"],
# Rustfmt configuration
# https://github.com/rust-lang/rustfmt/blob/HEAD/Configurations.md
max_width = 120
# Set the default settings again to always apply the proper formatting without
# being affected by the editor settings.
edition = "2021"
hard_tabs = false
newline_style = "Unix"
tab_spaces = 4
# Rustfmt cannot format long lines inside macros, but this option detects this.
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3391)
error_on_line_overflow = true
# Override the default formatting style.
# See https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81.
use_small_heuristics = "Max"
# This is the default of 2024 edition https://github.com/rust-lang/rust/pull/114764.
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3370)
overflow_delimited_expr = true
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/4991).
imports_granularity = "Crate"
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/5083).
group_imports = "StdExternalCrate"
# Apply rustfmt to more places.
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3348).
format_code_in_doc_comments = true
# Automatically fix deprecated style.
use_field_init_shorthand = true
use_try_shorthand = true
# Other configs
error_on_unformatted = true
format_macro_bodies = true
format_macro_matchers = true
format_strings = true
wrap_comments = true