chore(dylint): bump perfectionist to 0.0.0-rc.12, trim style rules#519
chore(dylint): bump perfectionist to 0.0.0-rc.12, trim style rules#519KSXGitHub wants to merge 4 commits into
Conversation
…style rules rc.12 added rules that now enforce policies previously described only in CODE_STYLE_GUIDE.md: - `single_letter_generic`, `single_letter_function_param`, `single_letter_closure_param`, `single_letter_let_binding` cover the "Generic Parameter Naming" and "Variable and Closure Parameter Naming" sections. - `arc_rc_clone` covers the "Cloning `Arc` and `Rc`" section. Replace those sections with brief pointers to the perfectionist rule docs; the rule pages already explain the rationale, allowlists, and configuration knobs. Also document the `rules/` directory in perfectionist's repository as a fallback for AI agents that cannot run `cargo dylint` in their sandbox: read the rule descriptions at the same git ref pinned in `dylint.toml`.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…ros for rc.12 perfectionist 0.0.0-rc.12 ships four new single-letter rules that fire across the workspace, plus `prefer_raw_string`, `arc_rc_clone`, and a stricter `macro_argument_binding`. Bringing the codebase green: Renames (descriptive over single-letter — the policy `CODE_STYLE_GUIDE.md` already documented): - Workspace-wide: `<R: Reporter>` → `<Reporter: self::Reporter>` on the ~50 generic-fn sites that emit log events. `Reporter` shadows the trait of the same name within each fn; `self::Reporter` disambiguates the bound. Added a TODO on the trait def to revert to `<R: Reporter>` once perfectionist gains an `extra_allowed_idents` knob for generic type parameters. - Other generics: `T`/`K`/`V`/`I`/`S`/`D`/`E`/`H`/`F` → descriptive names (`Node`, `Key`, `Value`, `Iter`, `Spec`, `Ser`/`De`/`DeError`, `Hasher`, `Inner`, `Lookup`, …). - Function/closure parameters and `let` bindings — `s` → `text`/`path`/ `os_str`/etc., `e` → `event`/`error`/`entry`, `m` → `meta`/`map`/`msg`, `r`/`w` → `reader`/`writer`, etc. - `.0.clone()` on `Rc<…>` rewritten as explicit `Rc::clone(&…)` (`arc_rc_clone`). - A handful of `"…\"…\\…"` literals converted to raw strings (`prefer_raw_string`). - One `debug_assert_eq!(name, format!(…))` wrapped in `#[cfg(debug_assertions)]` so the `format!` call doesn't get hoisted into release builds (`macro_argument_binding`). Per-rule configuration in `dylint.toml`'s `["perfectionist::macro_argument_binding"]` table — DSL / compile-time / local macros where the rule's "exactly-once evaluation" heuristic is a false positive: `json`, `concat`, the `insta` `assert_*_snapshot` family, `allow_known_failure`, `static_env`, `case`, `rusqlite::params`.
main landed two slices of #438 (hoisted node-linker — fe27251 wires hoisted into the install pipeline, d0cf2b1 re-enables `BuildModules` under hoisted) while this branch had renamed every `<R: Reporter>` site to `<Reporter: self::Reporter>` for `perfectionist::single_letter_generic`. The textual conflicts are all the new emit/run sites the slices introduced (`InstallPackageBySnapshot::run`, the `if !is_hoisted` gate around `SymlinkDirectDependencies`, the hoisted-branch `link_hoisted_modules::<R>` call, the warm-snapshot `emit_warm_snapshot_progress::<R>` loop, and the new `Install::run` 3-tuple with `hoisted_locations`). Resolution: take main's new structure verbatim, then re-apply this branch's `R → Reporter` rename to every new site. Same treatment for the short closure params main added (`|s|`, `|c|` in `bin_dirs_in_all_parent_dirs`) — renamed to `|text|` / `|ch|` to keep `single_letter_closure_param` quiet. `cargo dylint --all -- --all-targets --workspace` is clean post-merge.
The single-letter-identifier renames pushed in 4758246 stretched some lines past rustfmt's column limit; `cargo fmt` re-wraps them into multi-line arg/where/closure-body forms. Also adds the trailing comma `perfectionist::macro_trailing_comma` wanted on the one assert! that fmt's body-break exposed.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #519 +/- ##
==========================================
+ Coverage 88.51% 88.58% +0.06%
==========================================
Files 125 125
Lines 13821 13948 +127
==========================================
+ Hits 12234 12356 +122
- Misses 1587 1592 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Integrated-Benchmark Report (Linux)Scenario: Frozen Lockfile
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5828555136799998,
"stddev": 0.09759504114688111,
"median": 2.57836841518,
"user": 2.5737847799999996,
"system": 3.5756884199999996,
"min": 2.42161205318,
"max": 2.72244870818,
"times": [
2.72244870818,
2.60010888518,
2.48672437618,
2.50884488118,
2.63930324718,
2.54008225418,
2.70814662918,
2.42161205318,
2.55662794518,
2.64465615718
]
},
{
"command": "pacquet@main",
"mean": 2.56052778368,
"stddev": 0.07515076379121839,
"median": 2.56527608818,
"user": 2.58172518,
"system": 3.5605434199999997,
"min": 2.40443120618,
"max": 2.65116095518,
"times": [
2.50217761118,
2.61903565618,
2.60712051218,
2.55309265918,
2.50190477618,
2.40443120618,
2.65116095518,
2.57007947118,
2.56047270518,
2.63580228418
]
},
{
"command": "pnpm",
"mean": 5.768430994379999,
"stddev": 0.05949517186488222,
"median": 5.75299010768,
"user": 8.38484478,
"system": 4.33721582,
"min": 5.69048519718,
"max": 5.88220705618,
"times": [
5.78243977318,
5.69048519718,
5.88220705618,
5.75278328518,
5.70347680218,
5.74782378718,
5.75319693018,
5.8524901411800005,
5.74742783318,
5.77197913818
]
}
]
}Scenario: Frozen Lockfile (Hot Cache)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7360814779000001,
"stddev": 0.06208170309115531,
"median": 0.7141001301000001,
"user": 0.37284668,
"system": 1.6273966999999998,
"min": 0.7033870491,
"max": 0.9069159221,
"times": [
0.9069159221,
0.7073254031000001,
0.7077843071000001,
0.7033870491,
0.7247878351000001,
0.7046253991000001,
0.7544431101000001,
0.7204159531000001,
0.7040580191000001,
0.7270717811
]
},
{
"command": "pacquet@main",
"mean": 0.7722869769,
"stddev": 0.046450712571085795,
"median": 0.7665422226,
"user": 0.37705078,
"system": 1.6361754000000002,
"min": 0.7168681771000001,
"max": 0.8513807411000001,
"times": [
0.7917727641000001,
0.8315094181000001,
0.7360115661000001,
0.7168681771000001,
0.7409375831000001,
0.8513807411000001,
0.7242679111000001,
0.7450729281000001,
0.7880115171000001,
0.7970371631000001
]
},
{
"command": "pnpm",
"mean": 2.467208736999999,
"stddev": 0.10174202668404508,
"median": 2.4585376476,
"user": 2.8177287800000004,
"system": 2.2126295,
"min": 2.3642513961,
"max": 2.6225393810999997,
"times": [
2.5124659991000002,
2.5172377771,
2.6225393810999997,
2.5561599931,
2.3777703771,
2.3644494051,
2.3642513961,
2.3682997301,
2.5843040151,
2.4046092961
]
}
]
} |
Summary
Bump perfectionist from
0.0.0-rc.7to0.0.0-rc.12and trim style rules that the new lints now enforce.rc.12 adds nine new lints, four of which overlap with prose in
CODE_STYLE_GUIDE.md:single_letter_generic,single_letter_function_param,single_letter_closure_param,single_letter_let_bindingreplace the "Generic Parameter Naming" and "Variable and Closure Parameter Naming" sections.arc_rc_clonereplaces the "CloningArcandRc" section.Those sections are collapsed into one-line pointers to the perfectionist rule pages, which already document the rationale, allowlists, and configuration knobs. The one nuance the lints don't cover — reserving
i/j/kfor index loops — is kept.CONTRIBUTING.mdgains a paragraph telling agents that cannot runcargo dylintin their sandbox to read rule descriptions from perfectionist'srules/directory at the same git ref pinned indylint.toml. The directory is auto-generated bygen-docsfrom the rule sources, so the docs always match the pinned behavior.Net diff:
+17 / −145.Test plan
just readypasses locally (the sandbox preparing this PR lackedtypos/nextest;cargo checkandcargo fmt --checkdid pass)Dylintjob runs cleanly against0.0.0-rc.12Written by an agent (Claude Code, claude-opus-4-7).