apollo_network: delete dead code - #15069
Conversation
fb1398b to
4171d43
Compare
matanl-starkware
left a comment
There was a problem hiding this comment.
@matanl-starkware made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on asaf-sw).
-- commits line 2 at r1:
I prefer to keep this code. Reporting peers is something we should consider adding as we move towards decentralization.
Code quote:
apollo_network: delete dead code
Delete the unused `simulate_connection_established` test helper in `peer_whitelist_test.rs`, along with the `#[allow(dead_code)]` that masked it and the imports (`ConnectedPoint`, `ConnectionEstablished`, `FromSwarm`) that become unused once it is gone. The helper has no callers anywhere in the file (it is a distinct function from the identically named, live helper in `peer_manager/test.rs`). Removing its `#[allow(dead_code)]` makes the compiler report it as never used in both the default and `--tests` configurations; after deletion the crate builds with zero dead-code/unused warnings in both configurations. Note: an earlier revision of this PR also removed `PeerManager::report_session` and `PeerManagerError::NoSuchSession`; per reviewer feedback that code is intentionally kept for upcoming peer-reporting/decentralization work, so it was restored and only the unrelated dead test helper remains. Verification (RUSTC_WRAPPER unset, CARGO_INCREMENTAL=0): - scripts/rust_fmt.sh — clean - cargo build -p apollo_network — zero warnings - cargo build -p apollo_network --tests — zero warnings - cargo clippy -p apollo_network --all-targets — clean - SEED=0 cargo test -p apollo_network — 126 + 25 passed, 0 failed
4171d43 to
35a4d30
Compare
|
Thanks @matanl-starkware — makes sense. I've restored The PR now only removes the unrelated, genuinely-unused Generated by Claude Code |
What
Deletes the unused
simulate_connection_establishedtest helper inpeer_whitelist_test.rs, along with the#[allow(dead_code)]that masked it and the imports (ConnectedPoint,ConnectionEstablished,FromSwarm) that become unused once it is gone.The helper has no callers anywhere in the file. (It is a distinct function from the identically named, still-live helper in
peer_manager/test.rs, which is untouched.) Removing its#[allow(dead_code)]makes the compiler report it as never used in both the default and--testsconfigurations; after deletion the crate builds with zero dead-code/unused warnings in both.Scope change from the first revision
An earlier revision also removed
PeerManager::report_session+PeerManagerError::NoSuchSession. Per @matanl-starkware's review, that code is intentionally kept for upcoming peer-reporting / decentralization work, so it has been fully restored (including its#[allow(dead_code)]). Only the unrelated dead test helper remains in this PR.Verification (
RUSTC_WRAPPERunset,CARGO_INCREMENTAL=0)scripts/rust_fmt.sh— cleancargo build -p apollo_network— zero warningscargo build -p apollo_network --tests— zero warningscargo clippy -p apollo_network --all-targets— cleanSEED=0 cargo test -p apollo_network— 126 + 25 passed, 0 failed