apollo_p2p_sync: remove stale allow(dead_code) - #14965
Open
asaf-sw wants to merge 1 commit into
Open
Conversation
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.
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.
Removes five stale
#[allow(dead_code)]annotations from the#[cfg(test)]test-support modulecrates/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_managerandTestArgs::mock_class_response_manager(struct fields) — both fields are read (moved out) whenTestArgsis destructured inclient/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 fieldmock_state_diff_response_manager, which carries no annotation.DataType::Transaction(enum variant) — constructed inclient/transaction_test.rs(e.g.(DataType::Transaction, TRANSACTION_QUERY_LENGTH)) andclient/test.rs.DataType::Class(enum variant) — constructed inclient/class_test.rs(e.g.(DataType::Class, len.try_into().unwrap()),Action::ReceiveQuery(..., DataType::Class)).Action::SendInternalBlock(enum variant) — constructed inclient/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, zerodead_code/never constructed/never readwarnings 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