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
109
110
111
# Clippy configuration for cc_auto_switch
# Official configuration reference: https://doc.rust-lang.org/clippy/
# ========================================
# Complexity Thresholds (Recommended)
# ========================================
# Type complexity: maximum acceptable type complexity
# Default is 200, but 50-80 is more reasonable for maintainable code
= 80
# Cognitive complexity: maximum acceptable cognitive complexity per function
# Default is 200, but 15-25 is industry standard for maintainability
= 25
# ========================================
# Import and Naming Policies
# ========================================
# Warn on ALL wildcard imports (including prelude, super, pub use)
# Stricter control over import practices
= true
# Disallow common placeholder/test names
# Use ".." to append to defaults: ["foo", "baz", "quux"] + custom names
= ["test", "temp", "dummy", ".."]
# Minimum identifier character threshold
# Prevent overly short variable names (except common single-char vars)
= 2
# Allow common short identifiers
= ["i", "j", "x", "y", "z", "w", "n", "id", ".."]
# ========================================
# Code Size and Structure Limits
# ========================================
# Maximum lines per function (default: 100)
# CLI tools benefit from smaller, focused functions
= 50
# Maximum trait bounds before linting (default: 3)
= 3
# Maximum boolean parameters per function (default: 3)
= 2
# Maximum boolean fields per struct (default: 3)
= 2
# ========================================
# File and Include Size Limits
# ========================================
# Maximum include file size in bytes (default: 1000000 = 1MB)
# Reasonable for CLI configuration files
= 65536
# ========================================
# Stack and Memory Limits
# ========================================
# Maximum stack size per function in bytes (default: 512000 = 512KB)
# CLI tools should avoid deep recursion
= 262144
# ========================================
# Disallowed Types (Security & Best Practices)
# ========================================
# Explicitly disallow problematic types with reasons and replacements
= [
{ = "std::collections::HashMap", = "Use BTreeMap for deterministic iteration", = "std::collections::BTreeMap" },
{ = "std::collections::HashSet", = "Use BTreeSet for deterministic iteration", = "std::collections::BTreeSet" },
]
# ========================================
# Arithmetic Safety
# ========================================
# Prevent arithmetic side effects in performance-critical code
# For CLI tools, be explicit about numeric operations
= []
# ========================================
# Module and Item Ordering
# ========================================
# Enforce consistent module organization
# Check all groupings: extern_crate, mod, use, macro, const, fn, etc.
= "all"
# ========================================
# Minimum Supported Rust Version
# ========================================
# CRITICAL: Set MSRV to match your project's rust-version in Cargo.toml
# This disables lints that require newer Rust features
# Update this to match: rust-version = "1.88" in Cargo.toml
= "1.88.0"
# ========================================
# Test-Specific Allowances
# ========================================
# Allow indexing/slicing in tests (common for test data manipulation)
= true
# Allow useless_vec in tests (sometimes needed for test compatibility)
= true
# ========================================
# Private Item Documentation
# ========================================
# Check documentation on private items (good for library quality)
# Set to false to only check public API documentation
= false
# Allow underscore-prefixed fields to skip documentation
= true