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
fix(unify): remove source-unused deps and streamline hot-path plumbing
Detect unused deps using both Cargo graph analysis and rustc's
`unused_crate_dependencies` diagnostics, so `unify --check`/`unify`
catch and remove deps that are resolved but never referenced in source.
(#11)
- add source unused detection in `UnusedDepFinder`
- add `UnusedReason::NotUsedInSource` and report support
- pass workspace root into unify analyzer/finder for source checks
- short-circuit source checks when no eligible deps exist
- replace dynamic JSON value walking with typed diagnostic parsing
- pre-index manifest paths as strings to avoid per-message
canonicalization
- cache canonical root once in `UnifyAnalyzer`
- reduce allocation/collect churn in run/changelog/toml formatting paths
- add small command builder helpers for git/cargo invocations
- update integration tests (issue #11 repro + fixtures using declared
deps)
- testing: replace ignored git command results with explicit existence
checks + fallible calls
- testing: remove sleep-based backup/timestamp assumptions in
test_unify_undo and test_clean
- testing: strengthen JSON assertions in config integration tests from
shape-only to value/behavior checks
-**Replaces workspace-hack** — enable `pin_transitives` for cargo-hakari equivalent
94
94
-**Configurable** — tune behavior in `rail.toml` (unused removal, feature pruning, sorting, and more).
95
95
96
+
Unused detection combines resolved-graph analysis with rustc diagnostics (`unused_crate_dependencies`) so deps that are resolved but never referenced are also removed. Optional deps and unconfigured target-gated deps are conservatively skipped.
Copy file name to clipboardExpand all lines: docs/config.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ Controls workspace dependency unification behavior. All options are optional wit
106
106
|`msrv`|`bool`|`true`| Compute and write MSRV to `[workspace.package].rust-version` (written as `major.minor.patch`). The MSRV is determined by `msrv_source`. |
107
107
|`enforce_msrv_inheritance`|`bool`|`false`| Ensure every workspace member inherits MSRV by setting `[package].rust-version = { workspace = true }` in each member's `Cargo.toml`. This makes `[workspace.package].rust-version` actually apply across the workspace. |
108
108
|`msrv_source`|`enum`|`"max"`| How to compute the final MSRV:<br>• `"deps"` - Use maximum from dependencies only (original behavior)<br>• `"workspace"` - Preserve existing rust-version, warn if deps need higher<br>• `"max"` - Take max(workspace, deps) - your explicit setting wins if higher |
109
-
|`detect_unused`|`bool`|`true`| Detect dependencies declared in manifests but absent from the resolved cargo graph. |
109
+
|`detect_unused`|`bool`|`true`| Detect unused dependencies using two signals: (1) declared deps absent from the resolved cargo graph, and (2) rustc `unused_crate_dependencies` diagnostics for deps that resolve but are never referenced in source. Optional deps and deps behind unconfigured target constraints are conservatively skipped. |
|`prune_dead_features`|`bool`|`true`| Remove features that are never enabled in the resolved dependency graph across all targets. Only prunes empty no-ops (`feature = []`). Features with actual dependencies are preserved. |
112
112
|`preserve_features`|`string[]`|`[]`| Features to preserve from dead feature pruning. Supports glob patterns (e.g., `"unstable-*"`, `"bench*"`). Use this to keep features intended for future use or external consumers. |
0 commit comments