Skip to content

Re-enable perfectionist::needless_borrowed_parameters (pacquet/pnpr) #34

Closed
pnpm/pnpm
#12784

Description

@KSXGitHub

Context

The perfectionist dylint library was upgraded to 0.0.0-rc.21 (branch claude/perfectionist-rc21-upgrade-9rfgpq). That release ships a new active-by-default rule, perfectionist::needless_borrowed_parameters, which flags a &str / &Path parameter whose only use in the body is to produce its owned counterpart (String / PathBuf), and suggests taking the owned type by value so the caller decides whether to move or clone.

The rule fired ~173 times across the Rust workspace. Acting on it is not a mechanical autofix:

  • The suggestion is MaybeIncorrect — it rewrites the signature (x: &str → x: String) but not the call sites, so applying it blind breaks the build.
  • Every flagged function needs its call sites updated, and many of those signatures mirror their pnpm counterparts. Flipping them touches pacquet's parity with the TypeScript CLI (the cardinal rule in pacquet/AGENTS.md) and runs against the "prefer borrowed parameters" guidance in pacquet/CODE_STYLE_GUIDE.md.

Decision

For the upgrade PR the rule is disabled in dylint.toml:

[perfectionist]
disable = ["needless_borrowed_parameters"]

Follow-up (this issue)

Re-enable the rule as a focused, parity-reviewed pass:

  1. Remove needless_borrowed_parameters from the disable list in dylint.toml.
  2. For each finding, take the owned type by value and update call sites, confirming the change does not diverge from the corresponding pnpm signature (or is a pacquet-internal helper with no pnpm counterpart).
  3. Run cargo dylint, cargo clippy, and the test suite locally.

A handful of the findings are in test helpers (*/tests.rs) and are low-risk; the production-code findings are the ones that need parity review.


Written by an agent (Claude Code).

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions