Skip to content

refactor: delete dead code revealed by removing dead_code allows#1052

Merged
joshrotenberg merged 1 commit into
chore/code-12-drop-libfrom
chore/code-12-remove-allows
Jul 24, 2026
Merged

refactor: delete dead code revealed by removing dead_code allows#1052
joshrotenberg merged 1 commit into
chore/code-12-drop-libfrom
chore/code-12-remove-allows

Conversation

@joshrotenberg

Copy link
Copy Markdown
Collaborator

Summary

Phase 2b of the de-complexification (#1049), finding CODE-12. Stacked on #1051 (base is chore/code-12-drop-lib); review/merge that first.

With the lib target gone (#1051), the 106 #[allow(dead_code)] annotations in crates/redisctl/src (42 blanket module-level, 64 item-level) were pointless: they existed because the lib compiled every module and used none. Removing them all turns the dead-code lint back on for the binary. It flagged 24 genuinely dead items.

Deleted (20)

  • Superseded LDAP path: rbac.rs::handle_ldap_command and five rbac_impl.rs LDAP functions. enterprise ldap runs through ldap.rs; these were the old implementation.
  • Superseded debuginfo: handle_debuginfo_all/node/database. The live command uses the _binary variants.
  • Unused helpers: two ACL detail printers, parse_database_id, the OptimizationResult struct + method, two support-package 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)] + comment (5, see #1049)

These are not cruft, so they were not cut:

  • error.rs NoProfileConfigured / MissingCredentials / UnsupportedDeploymentType: intended error types with good messages and suggestions(), but no code path constructs them (the CLI reports these conditions with generic errors instead). A latent UX improvement to wire up.
  • connection.rs CloudConnectionInfo / EnterpriseConnectionInfo credential fields: populated but never read by the curl builder, so api ... --curl output omits its auth headers. That looks like a real bug; kept pending a fix rather than deleted.

Result

Net ~670 lines removed. 5 documented allows remain instead of 106 blanket ones, and the dead-code lint now covers the whole crate, so new dead code will be caught going forward.

Validation

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace --all-features: all pass, zero failures.

Follow-ups (flagged, not done here)

  1. Wire up the three error variants (small behavior PR).
  2. Fix api ... --curl to emit auth headers, then the connection-info credential fields become live.

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.
@joshrotenberg
joshrotenberg merged commit 3c37e2c into chore/code-12-drop-lib Jul 24, 2026
6 checks passed
@joshrotenberg
joshrotenberg deleted the chore/code-12-remove-allows branch July 24, 2026 00:44
joshrotenberg added a commit that referenced this pull request Jul 24, 2026
* refactor: drop the redundant redisctl lib target

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.

* refactor: delete dead code revealed by removing dead_code allows (#1052)

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.

* ci: use per-package test target flags now that redisctl is bin-only

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.
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