-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrustfmt.toml
More file actions
108 lines (81 loc) · 4.08 KB
/
rustfmt.toml
File metadata and controls
108 lines (81 loc) · 4.08 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# .rustfmt.toml
# -------------------------------------------------------------------------------------
# LINE WIDTH & INDENTATION
# -------------------------------------------------------------------------------------
# The maximum width of each line. Commonly 80 for narrower displays,
# or 100 if you prefer a bit more breathing room.
max_width = 130
# Number of spaces per tab.
tab_spaces = 4
# Use spaces instead of tabs.
hard_tabs = true
# -------------------------------------------------------------------------------------
# COMMENT FORMATTING
# -------------------------------------------------------------------------------------
# Wrap comments to max_width where possible.
wrap_comments = true
# If you’d like to limit comment lines to something shorter than max_width,
# uncomment and adjust the following:
# comment_width = 80
# -------------------------------------------------------------------------------------
# IMPORTS & GROUPING
# -------------------------------------------------------------------------------------
# Merge imports from the same module.
# merge_imports = true
# Controls the style used for grouping imports:
# - "Preserve": Keep the existing groups untouched.
# - "StdExternalCrate": Group std, external, and crate-specific in separate groups.
# - "One": Put everything in a single group.
group_imports = "StdExternalCrate"
# Adjust how much to split or merge imports. Possible values:
# - "Preserve"
# - "Crate"
# - "Module"
# - "Item"
imports_granularity = "Crate"
# Whether to reorder imports alphabetically within their groups.
reorder_imports = true
# -------------------------------------------------------------------------------------
# BRACES & BLOCKS
# -------------------------------------------------------------------------------------
# Controls brace placement. Common choices:
# - "AlwaysSameLine": e.g. `fn foo() {`
# - "AlwaysNextLine": e.g. `fn foo()\n{`
# - "PreferSameLine": tries same line unless it’s too long
brace_style = "SameLineWhere"
# -------------------------------------------------------------------------------------
# NEWLINES & GENERAL LAYOUT
# -------------------------------------------------------------------------------------
# How many consecutive blank lines are allowed. Setting both to 1 helps keep the code tight.
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
# The line endings to use. Common options: "Unix", "Windows", or "Auto"
newline_style = "Unix"
# Controls trailing commas in multi-line lists (structs, enums, function params, etc.).
# Recommended to keep them for cleaner diffs:
trailing_comma = "Never"
# If the code becomes too dense, you can force multi-line blocks in match arms, function calls, etc.
# Setting this to "true" can significantly expand vertical space, so use with care.
force_multiline_blocks = false
# -------------------------------------------------------------------------------------
# EDITION & VERSION
# -------------------------------------------------------------------------------------
# Format code as if it's Rust 2021 edition (or 2018 if your project is older).
edition = "2021"
# By default, rustfmt uses the classic style; version=2 is an experimental style in development.
# You can enable it if you prefer or want to try the newer format rules:
# version = 2
# -------------------------------------------------------------------------------------
# OTHER HANDY SETTINGS
# -------------------------------------------------------------------------------------
# Rustfmt can shorten field names if possible in struct initializers, e.g. `x: x` -> `x`.
use_field_init_shorthand = true
# Rustfmt can convert code like `try!(x)` to the `?` operator.
# Usually not needed anymore, but can be helpful in legacy codebases.
use_try_shorthand = true
# The style for binary operator layout. "Front" places the operator at the start of the new line.
# If you prefer to have the operator at the end of the previous line, set this to "Back".
binop_separator = "Front"
# How to handle function argument layout when they exceed max_width.
# Options include: "Tall", "Block", or "Compressed".
fn_params_layout = "Compressed"