Skip to content

apollo_p2p_sync: remove stale allow(dead_code) - #14965

Open
asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_stale_allow_in_apollo_p2p_sync
Open

apollo_p2p_sync: remove stale allow(dead_code)#14965
asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_stale_allow_in_apollo_p2p_sync

Conversation

@asaf-sw

@asaf-sw asaf-sw commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Removes five stale #[allow(dead_code)] annotations from the #[cfg(test)] test-support module crates/apollo_p2p_sync/src/client/test_utils.rs. Each annotated item is now live in the crate's test build, so the annotations no longer suppress any warning.

The annotations and the live references that make them stale

  • TestArgs::mock_transaction_response_manager and TestArgs::mock_class_response_manager (struct fields) — both fields are read (moved out) when TestArgs is destructured in client/header_test.rs (e.g. mock_transaction_response_manager: _transaction_receiver), held to keep the channels alive during the test. This is the same pattern as the sibling field mock_state_diff_response_manager, which carries no annotation.
  • DataType::Transaction (enum variant) — constructed in client/transaction_test.rs (e.g. (DataType::Transaction, TRANSACTION_QUERY_LENGTH)) and client/test.rs.
  • DataType::Class (enum variant) — constructed in client/class_test.rs (e.g. (DataType::Class, len.try_into().unwrap()), Action::ReceiveQuery(..., DataType::Class)).
  • Action::SendInternalBlock (enum variant) — constructed in client/test.rs (Action::SendInternalBlock(sync_block), several call sites).

Verification (env: RUSTC_WRAPPER= unset, CARGO_INCREMENTAL=0)

  • cargo build -p apollo_p2p_sync — clean, zero dead_code warnings.
  • cargo build -p apollo_p2p_sync --tests — clean, zero dead_code/never constructed/never read warnings with all five annotations removed. This is the load-bearing check, since the module is #[cfg(test)].
  • cargo clippy -p apollo_p2p_sync --all-targets — clean.
  • SEED=0 cargo test -p apollo_p2p_sync — all tests pass (26 passed, 0 failed).

Behavior-neutral: the change only removes lint annotations from test-only code.


Generated by Claude Code

Removes five stale `#[allow(dead_code)]` annotations from the `#[cfg(test)]`
test-support module `crates/apollo_p2p_sync/src/client/test_utils.rs`. Each
annotated item is now live in the crate's test build, so the annotations no
longer suppress any warning.

The annotations and the live references that make them stale:

- `TestArgs::mock_transaction_response_manager` and
  `TestArgs::mock_class_response_manager` (struct fields) are read (moved out)
  when `TestArgs` is destructured in `client/header_test.rs` (e.g.
  `mock_transaction_response_manager: _transaction_receiver`), held to keep the
  channels alive during the test. This is the same pattern as the sibling field
  `mock_state_diff_response_manager`, which carries no annotation.
- `DataType::Transaction` (enum variant) is constructed in
  `client/transaction_test.rs` and `client/test.rs`.
- `DataType::Class` (enum variant) is constructed in `client/class_test.rs`.
- `Action::SendInternalBlock` (enum variant) is constructed in `client/test.rs`.

Verification (env: RUSTC_WRAPPER unset, CARGO_INCREMENTAL=0):
- `cargo build -p apollo_p2p_sync` - clean, zero dead_code warnings.
- `cargo build -p apollo_p2p_sync --tests` - clean, zero
  dead_code/never-constructed/never-read warnings with all five annotations
  removed (load-bearing check: the module is `#[cfg(test)]`).
- `cargo clippy -p apollo_p2p_sync --all-targets` - clean.
- `SEED=0 cargo test -p apollo_p2p_sync` - all tests pass (26 passed, 0 failed).

Behavior-neutral: only lint annotations on test-only code are removed.
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

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.

3 participants