refactor(rca): drop two manifest dependencies nothing in the crate uses - #286
Merged
Conversation
`codelore-rca` declared `serde_json` and `rayon` and references neither. They are residue from upstream `rust-code-analysis`, which used them for JSON output and parallel walking; the vendored subset that survives here does neither. Nothing about the build changes. Both remain in the graph as direct dependencies of `codelore-lib` (and `serde_json` of `codelore-cli`), so this is manifest hygiene rather than a supply-chain or compile-time reduction. The value is that a vendored crate's manifest should describe what the vendored code actually needs; overstating it misleads the next person working out what the fork still depends on. `num-traits` was in the same candidate list and is deliberately KEPT. It is required and only looks unused: six generated `language_*.rs` files derive `FromPrimitive`, and num-derive's macros expand to bare `num_traits::` paths that must resolve in this crate's own extern prelude. The crate does not use the `#[num_traits = "..."]` helper that would let a transitive copy serve, so removing the declaration fails with `error[E0463]: can't find crate for num_traits`. That distinction is why these two removals were confirmed by building without them rather than by searching for them. "Absent from the source text" and "safe to remove" are different predicates; a text-based unused-dependency scanner reports the first while implying the second, and this crate is a live counter-example to that implication. Gate: fmt --check clean, clippy --workspace --all-targets --all-features -D warnings clean, 1746 tests pass -- the same count as before, so no test was lost with the declarations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the surviving half of cycle 18's finding F (validated in #285).
What was removed
codelore-rcadeclaredserde_jsonandrayonand references neither — residue from upstreamrust-code-analysis, which used them for JSON output and parallel walking. The vendored subset that survives here does neither.Nothing about the build changes. Both remain in the graph as direct dependencies of
codelore-lib(andserde_jsonofcodelore-clitoo), so this is manifest hygiene, not a supply-chain or compile-time reduction. The value is that a vendored crate's manifest should describe what the vendored code actually needs.What was deliberately kept, and why it matters
num-traitswas in the same candidate list. It is required and only looks unused.Six generated
language_*.rsfiles deriveFromPrimitive, andnum-derive's macros expand to barenum_traits::paths that must resolve in this crate's own extern prelude. The crate does not use the#[num_traits = "…"]helper that would let a transitive copy serve. Removing the declaration fails:This is why the two removals were confirmed by building without them, not by searching for them. "Absent from the source text" and "safe to remove" are different predicates — a text-based unused-dependency scanner reports the first while implying the second, and this crate is a live counter-example.
It also qualifies the
cargo-macheterecommendation in cycle 18: such a step is still worth wiring, but must listnum-traitsinpackage.metadata.cargo-machete.ignoredand be read as a candidate list. A gate that is wrong about this crate on day one — and whose wrongness compiles cleanly until someone acts on it — would automate the exact failure these cycles keep catching.Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-featuresSame test count as before the change, so nothing was lost with the declarations. Lockfile drops 2 lines; no version resolutions move.