Skip to content

chore: prune #[allow(dead_code)] cluster (#327)#470

Merged
intendednull merged 1 commit into
claude/friendly-maxwell-Oggvwfrom
auto-fix/issue-327-dead-code-cleanup
Apr 28, 2026
Merged

chore: prune #[allow(dead_code)] cluster (#327)#470
intendednull merged 1 commit into
claude/friendly-maxwell-Oggvwfrom
auto-fix/issue-327-dead-code-cleanup

Conversation

@intendednull
Copy link
Copy Markdown
Owner

audit #327 listed 13 dead_code annotations. count drifted to 10 (storage.rs gone, 2 web sites already cleaned).

actions per site

delete (genuinely unused):

  • crates/web/src/app.rs::toggle_theme — fn never called. theme toggling routes through palette_actions::on_toggle_theme Callback.

remove redundant annotation (symbol IS used):

  • crates/web/src/palette_recents.rs::clear — used in browser test fixtures (tests/browser.rs:5043, 5066).
  • crates/web/tests/browser.rs::TestShell enum — used by every flow test via mount_app_fresh.
  • crates/web/tests/browser.rs::mount_test_with_shell — used 30+ times throughout browser.rs.
  • crates/web/tests/browser.rs::ensure_components_css_loaded — called by mount_test_with_shell + test_support::ensure_app_css.
  • crates/web/tests/browser.rs::mod test_support — used by basic_flow, mobile_ux, mobile_actions modules.
  • crates/web/src/state.rs::ChatWriteSignals::set_pinned_messages — used in state.rs:952 (Effect feeds pinned signal).
  • crates/web/src/state.rs::ChatWriteSignals::set_pin_labels — fed by struct init only, but masked by crate-wide #![allow(dead_code)] in willow-web — per-field annotation was always redundant.
  • crates/web/src/components/mobile_shell.rs::MobilePush — Channel/Thread/Call/Onboarding all match-bound; Thread/Call/Onboarding planned per docs/plans/2026-04-20-ui-phase-1b-mobile-shell.md. no warning fires.

keep with reason:

  • crates/actor/src/fsm.rs::DoorState::OpenStrictDoor test fixture starts in Closed and asserts further transitions are rejected. Open exists for completeness in the enum but is never constructed; removing the annotation triggers variant Open is never constructed. Replaced with #[allow(dead_code, reason = ...)] (rust 1.81+).

scope-creep guard

willow-web/src/lib.rs carries crate-wide #![allow(dead_code)]. that's masking 9 other dead symbols across 5 unrelated files (downgrade_banner, day_separator, nickname_store, trust_store). per coordinator's >5-files / >200-LOC guard, left intact — separate follow-up. that crate-wide allow also explains why some per-site annotations on willow-web items were no-ops; removing them is still correct hygiene since the crate-wide allow itself should eventually go.

tradeoffs

runner-up for MobilePush: keep #[allow(dead_code)] since 3/4 variants never constructed. rejected because match arms on those variants count as use — no warning fires; annotation is misleading.

runner-up for DoorState: delete Open variant entirely. rejected because the enum's binary state models a real door and the StrictDoor::transition match state on DoorState::Open => Ok(...) arm is the readable rejection-path test surface; gutting it would force _ arms or single-variant enums.

verify

  • cargo check --workspace --all-targets — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo test --workspace — all green (90 actor + 298 client + 227 state + ...)
  • cargo check --target wasm32-unknown-unknown -p willow-web --tests — clean

Refs #327


Generated by Claude Code

audit #327 listed 13 sites. count drifted to 10 (storage.rs and 2
others removed in earlier work). per-site breakdown:

deletes (genuinely unused):
- crates/web/src/app.rs::toggle_theme — never called; on_toggle_theme
  Callback wires through palette_actions, not this fn.

remove redundant annotation (symbol used):
- crates/web/src/palette_recents.rs::clear — used by browser tests.
- crates/web/tests/browser.rs::TestShell, mount_test_with_shell,
  ensure_components_css_loaded, mod test_support — all referenced
  throughout browser.rs flow tests.
- crates/web/src/state.rs::set_pinned_messages — used in state.rs:952.
- crates/web/src/state.rs::set_pin_labels — fed by struct init only;
  field access not warned because crate-wide #![allow(dead_code)] in
  willow-web/src/lib.rs already masks it. annotation was redundant.
- crates/web/src/components/mobile_shell.rs::MobilePush — match arms
  on Thread/Call/Onboarding count as use; no warning even when one
  variant is constructed.

keep with reason:
- crates/actor/src/fsm.rs::DoorState::Open — test fixture for
  StrictDoor rejection path; never constructed because tests start
  in Closed and assert further transitions are rejected. Kept with
  #[allow(dead_code, reason = ...)] (rust 1.81+).

verification: cargo check --workspace --all-targets clean; cargo
clippy -D warnings clean; cargo test --workspace passes; wasm32 lib
+ tests build clean.

scope-creep guard hit: removing willow-web's crate-wide
#![allow(dead_code)] surfaces 9 unrelated dead symbols across 5
files. left as-is — separate follow-up.

Refs #327
@intendednull intendednull merged commit 20f1ed1 into claude/friendly-maxwell-Oggvw Apr 28, 2026
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.

2 participants