-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrustfmt.toml
More file actions
102 lines (76 loc) · 3.32 KB
/
Copy pathrustfmt.toml
File metadata and controls
102 lines (76 loc) · 3.32 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
# Rustfmt configuration for systemprompt.io code formatting standards
# Requires nightly Rust (configured via rust-toolchain.toml)
# See: tests/validator/coding-standards.md
# ============================================================================
# EDITION
# ============================================================================
edition = "2024"
# ============================================================================
# LINE WIDTH AND INDENTATION
# ============================================================================
# Maximum line width - balances readability with horizontal space
max_width = 100
# Use spaces, not tabs (consistency across editors)
hard_tabs = false
tab_spaces = 4
# ============================================================================
# IMPORT ORGANIZATION
# ============================================================================
# Automatically reorder imports (std -> external -> workspace -> local)
reorder_imports = true
# Group imports by module
# Example:
# use std::collections::HashMap;
# use std::sync::Arc;
#
# use anyhow::Result;
# use tokio::sync::RwLock;
imports_granularity = "Module"
# ============================================================================
# FUNCTION AND TYPE FORMATTING
# ============================================================================
# Force explicit ABI on extern functions for clarity
force_explicit_abi = true
# Remove unnecessary nested parentheses
remove_nested_parens = true
# Control heuristics for formatting small items
use_small_heuristics = "Default"
# Prefer explicit Ok/Err over try! macro (try! is deprecated)
use_try_shorthand = false
# Prefer explicit field initialization over shorthand
# Example: Agent { id: id } instead of Agent { id }
# Rationale: Explicit is clearer, matches our "no abbreviations" rule
use_field_init_shorthand = false
# ============================================================================
# WHITESPACE AND NEWLINES
# ============================================================================
# Unix line endings (LF not CRLF)
newline_style = "Unix"
# Blank lines - preserve structure
blank_lines_upper_bound = 2
blank_lines_lower_bound = 0
# ============================================================================
# COMMENTS
# ============================================================================
# Normalize comment formatting
normalize_comments = true
# Wrap comments at max_width
wrap_comments = true
# Format code in doc comments (``` blocks)
format_code_in_doc_comments = true
# ============================================================================
# MATCH AND CONTROL FLOW
# ============================================================================
# Control flow brace style
brace_style = "SameLineWhere"
# Match block formatting - prefer block style
match_block_trailing_comma = true
# ============================================================================
# MISCELLANEOUS
# ============================================================================
# Do NOT enable `format_strings`: the unstable splitter mangles long string
# literals containing escaped quotes (e.g. JSON test fixtures), terminating
# them early and producing syntax errors on every `cargo fmt` run.
format_strings = false
# Merge derives into single line when possible
merge_derives = true