You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Verified the guidance against `perfectionist` 0.0.0-rc.17 and corrected
three claims that did not match the rules:
- Remove the fabricated `short_impl_max_lines` knob from the generic
naming section. The `single_letter_generic` rule has no configuration;
canonical cases are silenced site-by-site with `#[allow]` or
`#[expect]`.
- Rename the `allowed_idents` knob to `extra_allowed_idents`, which is
the actual field name for the variable and closure rules.
- Clarify that `i`/`j`/`k` are exempt as function and closure parameters
but not as `let` bindings, where only `n` is allowed.
https://claude.ai/code/session_01CMrfXtuzxpSbchSJNuwboK
Single-letter generics are acceptable only in very short, self-contained trait impls. Enforced by `perfectionist::single_letter_generic`; the threshold for "very short" is the rule's `short_impl_max_lines` knob in `dylint.toml`.
92
+
Single-letter type parameters are flagged by `perfectionist::single_letter_generic`, which has no configuration. Genuinely canonical cases, such as `impl<T> From<T> for Wrapper<T>` where the trait already fixes the role of `T`, may be silenced site-by-site with `#[allow]` or `#[expect]`.
93
93
94
94
### Variable and Closure Parameter Naming
95
95
96
-
Use **descriptive names** for variables and closure parameters by default. Single-letter names are permitted only in the specific cases listed below. Enforced by `perfectionist::single_letter_let_binding`, `perfectionist::single_letter_function_param`, and `perfectionist::single_letter_closure_param`; the per-rule `allowed_idents` and `extra_trivial_callback_methods` knobs in `dylint.toml`reflect the exceptions documented here.
96
+
Use **descriptive names** for variables and closure parameters by default. Single-letter names are permitted only in the specific cases listed below. Enforced by `perfectionist::single_letter_let_binding`, `perfectionist::single_letter_function_param`, and `perfectionist::single_letter_closure_param`. The exact exemptions differ by binding kind, as the cases below describe. The `extra_allowed_idents` and `extra_trivial_callback_methods` knobs in `dylint.toml`extend the built-in exempt sets, though the project currently relies on the defaults aside from the `sort_reflection_by` callback.
97
97
98
98
#### When single-letter names are allowed
99
99
@@ -110,16 +110,16 @@ Use **descriptive names** for variables and closure parameters by default. Singl
-**Index variables (`i`, `j`, `k`):** These may only be used in two contexts: short closures, and index-based loops or iterations. The latter is rare in Rust. In all other cases, use `index`, `idx`, or `*_index`.
113
+
-**Index variables (`i`, `j`, `k`):** These are exempt as function and closure parameters, and they read naturally in index-based loops or iterations, which are rare in Rust. They are not exempt as `let` bindings, where only `n` is allowed, so a `let` that holds an index must use `index`, `idx`, or `*_index` instead.
0 commit comments