Skip to content

chore: drop 30 dead_code allows that no longer cover anything - #6946

Open
Lstarsky0 wants to merge 1 commit into
codewhale-hq:mainfrom
Lstarsky0:chore/drop-stale-dead-code-allows
Open

Lstarsky0 wants to merge 1 commit into
codewhale-hq:mainfrom
Lstarsky0:chore/drop-stale-dead-code-allows

Conversation

@Lstarsky0

Copy link
Copy Markdown
Contributor

What and why

Another #5587 slice, the "stale allows" part of the tail. I ran cargo check --workspace --all-targets with RUSTFLAGS="--force-warn dead_code", then the non-test and test targets on their own, and matched every allow(dead_code) against the warnings inside the item it covers. For these 30, rustc reports nothing in the build the attribute applies to, so they suppress nothing:

  • palette: adapt.rs (5), contrast.rs (4), grammar.rs (2). These modules are pub used from the crate root under the default ratatui feature.
  • runtime: model_context/fragment.rs (5), retry_status.rs (2).
  • tui: approval_log.rs, core/engine/dispatch.rs, llm_client/mod.rs (3), route_billing.rs (2), skills/mutation.rs, tui/hotbar/actions.rs, tui/transcript_cache.rs, tui/widgets/tool_card.rs (2).

hotbar/actions.rs keeps its clippy::large_enum_variant. The doc on SECONDARY_CHROME_CONTRAST said the constant only feeds the test-gate audit, "hence the dead_code allowance"; tui/whales.rs uses it at runtime, so that paragraph goes with the allow.

Left alone even though the pass found them stale:

Nothing here sits in a platform-gated block, and none of these items is reached only from cfg(unix) or cfg(windows) code, so the macOS result holds for the Windows build too.

Main measures 252 against a ceiling of 258. With this change it is 222, and the budget file is regenerated with --update. #6943 regenerates the same file, so whichever of the two lands second will conflict there; I'll redo --update on that branch when it happens.

Issue

Refs #5587

How I tested it

  • On CI's toolchains (run with chore(tui): drop the blanket dead_code allow in five modules #6943 applied on top as well): cargo +1.99.0 clippy --workspace --all-targets --all-features with CI's flags, cargo +1.99.0 fmt --check, cargo +1.99.0 check --workspace --lib --bins, and the MSRV job's cargo +1.89.0 check --workspace. All clean.
  • cargo fmt --all -- --check, and cargo check / cargo clippy (CI's flags, --all-features) for palette, runtime and tui with --all-targets: clean.
  • cargo nextest run -p codewhale-palette -p codewhale-runtime -p codewhale-tui --lib: 15623 passed, 47 failed. The 47 failures are exactly the ones current main fails on my machine (most need an extension-host Node version I don't have).
  • check-dead-code-budget.py passes. check-blocking-calls-budget.py fails, but it fails the same way on current main (one new std::fs site in crates/tui/src/oauth.rs), and this change doesn't touch it.

No new tests; removing an attribute that suppresses nothing does not change behaviour.

Checklist

  • One focused change, rebased on current main
  • cargo fmt --all passes, and tests cover new or changed behavior
  • If this adds or changes a user-facing feature, I updated its docs and its row in docs/features.toml (cargo test -p codewhale-tui --test feature_registry checks it) — n/a

Refs codewhale-hq#5587

A `--force-warn dead_code` pass over the workspace (`cargo check
--workspace --all-targets`, then the non-test and test targets on their
own) reports nothing inside any of these 30 attributes, in the build each
one applies to. They suppress nothing:

- palette: adapt.rs (5), contrast.rs (4), grammar.rs (2). These modules are
  `pub use`d from the crate root under the default `ratatui` feature.
- runtime: model_context/fragment.rs (5), retry_status.rs (2).
- tui: approval_log.rs, core/engine/dispatch.rs, llm_client/mod.rs (3),
  route_billing.rs (2), skills/mutation.rs, tui/hotbar/actions.rs,
  tui/transcript_cache.rs, tui/widgets/tool_card.rs (2).

hotbar/actions.rs keeps `clippy::large_enum_variant`. The doc on
`SECONDARY_CHROME_CONTRAST` said the constant only feeds the test-gate
audit, "hence the dead_code allowance"; tui/whales.rs uses it at runtime,
so that paragraph goes with the allow.

Left alone although the pass found them stale too:
- runtime prompt_zones.rs `TurnScratch`: its comment records that rustc
  1.89 and newer rustc disagree about it (codewhale-hq#6543).
- 22 allows in files other open PRs (the 0.10.2 wave among them) were
  changing when I ran the pass.
Nothing here sits in a platform-gated block, and none of these items is
reached only from `cfg(unix)` or `cfg(windows)` code.

Budget: 252 -> 222 (`check-dead-code-budget.py --update`).
@Lstarsky0
Lstarsky0 requested a review from Hmbown as a code owner October 9, 2026 11:28

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added the contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm label Oct 9, 2026

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

contribution-gate Author not yet in .github/APPROVED_CONTRIBUTORS; a maintainer grants access with /lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants