apollo_node_config: remove stale allow(dead_code)#14397
Open
asaf-sw wants to merge 1 commit into
Open
Conversation
Removes a stale `#[allow(dead_code)]` from the `VERSION_META` constant in `version.rs`. The constant is NOT dead — it is read unconditionally in production code: - `full_version_str()` matches on `VERSION_META` (version.rs:43) to decide whether to append the dev metadata suffix. - `full_version_str()` is evaluated by the `pub const VERSION_FULL` (version.rs:22), a public entry point. So `VERSION_META` is reachable from a live public root and the annotation is stale. Only the annotation is removed; no behavior changes. Note: the sibling annotations in this file (on `Metadata`, `metadata_str`, `STABLE_VERSION_META`, `DEV_VERSION_META`) are intentionally KEPT — those items are only reachable from `version_test.rs` (the `Metadata::Stable` variant is never constructed and `metadata_str` is only called from the test), so they are genuinely dead in the default build and their annotations are load-bearing. Verification (RUSTC_WRAPPER unset, CARGO_INCREMENTAL=0): - `scripts/rust_fmt.sh` — clean - `cargo build -p apollo_node_config` — zero dead_code warnings - `cargo clippy -p apollo_node_config --all-targets` — clean (covers --tests cfg) - `SEED=0 cargo test -p apollo_node_config` — 16 passed, 0 failed
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.
What
Removes a stale
#[allow(dead_code)]annotation from theVERSION_METAconstant incrates/apollo_node_config/src/version.rs. The constant is not dead — only the annotation is removed. No behavior changes.Why it's stale (live, non-feature-gated reader)
VERSION_METAis read unconditionally in production code:full_version_str()matches onVERSION_META(version.rs:43) to decide whether to append the dev metadata suffix.full_version_str()is evaluated bypub const VERSION_FULL(version.rs:22), a public entry point.So
VERSION_METAis reachable from a live public root; the dead-code annotation is stale.Sibling annotations intentionally KEPT (load-bearing)
The other
#[allow(dead_code)]annotations in this file are not removed because the items are genuinely dead in the default build (only reachable fromversion_test.rs):Metadataenum /Metadata::Stablevariant —Stableis never constructed in non-test code (VERSION_META == Metadata::Dev).metadata_str— only called fromversion_test.rs.STABLE_VERSION_META— only referenced from the test-onlymetadata_str.Removing those would re-introduce
dead_code/never constructedwarnings, so they stay.Verification (
RUSTC_WRAPPERunset,CARGO_INCREMENTAL=0)scripts/rust_fmt.sh— cleancargo build -p apollo_node_config— zero dead_code warnings (default cfg)cargo clippy -p apollo_node_config --all-targets— clean (covers--testscfg)SEED=0 cargo test -p apollo_node_config— 16 passed, 0 failedhttps://claude.ai/code/session_01JySgtGzptZGSVtkdguAaHA
Generated by Claude Code