refactor: drop the redundant redisctl lib target#1051
Merged
Conversation
The redisctl crate had both a lib target (lib.rs, declaring every module pub(crate)) and a bin target (main.rs, re-declaring the same modules), so the whole tree compiled twice. The lib exposed no public API and was used by nothing (no test or bench imports redisctl::...); it existed only for a docs.rs page, and lib.rs itself says redisctl is not meant to be used as a library. Delete lib.rs and move its overview into a module doc on main.rs. The crate now compiles once, as a binary. This is the structural half of the lib/bin cleanup; removing the 110 now-pointless #[allow(dead_code)] annotations and deleting the dead code the lint then reveals is the follow-up. Part of #1049 (CODE-12), phase 2a.
Removed all 106 #[allow(dead_code)] annotations from crates/redisctl/src (42 blanket module-level, 64 item-level), which existed only because the now-deleted lib target used nothing. The lint then flagged 24 genuinely dead items; deleted 20: - Superseded LDAP path: rbac.rs handle_ldap_command and five rbac_impl.rs LDAP functions (the live path is ldap.rs). - Superseded debuginfo handlers handle_debuginfo_all/node/database (the _binary variants are live). - Unused helpers: two ACL detail printers, parse_database_id, the OptimizationResult struct + method, two keyring helpers, build_database_payload, WorkflowResult::failure, ConnectionManager::save_config, and WorkflowContext.wait_timeout (set but never read, so init-cluster already ignored --wait-timeout). Kept with a targeted #[allow(dead_code)] and a comment (see #1049): - error.rs NoProfileConfigured / MissingCredentials / UnsupportedDeploymentType: intended error types with messages and suggestions that no code path constructs yet. To be wired up, not cut. - connection.rs CloudConnectionInfo / EnterpriseConnectionInfo credential fields: populated but not read by the curl builder, so `api ... --curl` omits its auth headers. Likely a real bug; kept pending that fix. Net ~670 lines removed; 5 documented allows remain instead of 106 blanket ones, and the dead-code lint now covers the whole crate. Part of #1049 (CODE-12), phase 2b.
Dropping the redisctl lib target broke the test-unit job: it ran cargo test --package <pkg> --lib --bins, and --lib errors with "no library targets found" for redisctl, which now has only a bin. Give each matrix package its own target flags: redisctl-core --lib, redisctl --bins, redisctl-mcp --lib --bins. --bins still runs the tests in main.rs (including the MCP safety-tier registration tests), so ci-status keeps gating them.
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.
Summary
Phase 2a of the de-complexification (#1049), finding CODE-12. Structural, behavior-preserving.
The
redisctlcrate had both a lib target (lib.rs, declaring every modulepub(crate)) and a bin target (main.rs, re-declaring the same modules), so the whole tree compiled twice. The lib exposed no public API and nothing used it (no test or bench importsredisctl::...); it existed only for a docs.rs page, andlib.rsitself states redisctl is not meant to be used as a library.Change
crates/redisctl/src/lib.rs.//!) at the top ofmain.rs, now stating plainly that redisctl is a binary and pointing library users at theredis-cloud/redis-enterprisecrates.cargo metadataconfirmsredisctlnow has a singlebintarget and nolib. Builds are one compilation instead of two.Validation
cargo build --workspace,cargo fmt --all -- --check,cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo test --workspace --all-features: all pass, zero failures. (The workspace test-group count drops by two: the now-removed empty lib unit-test and doctest targets. No real tests lost.)Next (phase 2b)
With the lib gone, the 110
#[allow(dead_code)]annotations that were suppressing the lib target's "everything is unused" warnings are pointless. Removing them turns the dead-code lint back on for the binary, which will reveal genuinely dead code to delete. That is the follow-up PR, where anything ambiguous (scaffolding labeled "will be used in future PRs") gets flagged for a keep-or-cut decision rather than deleted unilaterally.