Skip to content

Unused code: cargo-shear and Knip in CI (sc-9611) - #269

Open
ndbroadbent wants to merge 2 commits into
ci-squawkfrom
ci-unused
Open

ndbroadbent wants to merge 2 commits into
ci-squawkfrom
ci-unused

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Twelfth PR for sc-9611: unused code. It's stacked on #268. Talira had Knip for the JavaScript side and nothing for Rust. I chose cargo-shear over cargo-machete: it parses the code rather than grepping it, and it also catches misplaced and dev-only dependencies.

cargo-shear 1.14.1 (pinned in mise.toml) runs in CI's lint job on all three Rust workspaces. Fixed in this PR:

  • snapshot-diff came out of app/Cargo.toml: nothing in app/ uses it. Cargo.lock loses one line. It isn't in the renderer's inputs, and no CLI crate changes.
  • The Loco example's axum moved to [dev-dependencies]: only its tests use it.
  • app's migrations are compiled in by laravel::db::migrations!, not by mod, so they're listed as ignored-paths in [package.metadata.cargo-shear].

Knip 6.49.0 runs on frontend/ in the clients job, after the frontend's install (knip.jsonc).

  • Unused files and dependencies fail it. Unused exports (14) and types (22) are only reported for now: deleting them touches files other sessions are editing.
  • It runs with pnpm dlx at a pinned version rather than as a devDependency, which would add 550 lines to the frontend lockfile other branches edit.
  • Deleted: src/bindings/ (two files generated by ts-rs, which no crate uses any more).
  • One ignore, with its reason: @fontsource/geist, which scripts/og.mjs loads with require.resolve on a computed path.

Not yet: Knip on the gallery workspace and the scripts packages. Their examples and tests need entry config first, which is the gallery session's area, so it's a follow-up.

It starts green: cargo-shear exits 0 on all three workspaces (one warning: the empty database/seeders/mod.rs), and Knip exits 0. actionlint, the suppressions check and the file-length check are clean.


Show it working
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… frontend in CI; snapshot-diff out of app, axum a Loco dev-dependency, the stale ts-rs bindings deleted (sc-9611)
…token, Knip's entry is just site.mjs so an unused script fails, the empty seeders module is ignored by cargo-shear, and AGENTS.md says its file warnings don't fail

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant