Skip to content

apollo_node_config: remove stale allow(dead_code)#14397

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

apollo_node_config: remove stale allow(dead_code)#14397
asaf-sw wants to merge 1 commit into
mainfrom
code_slayer/remove_dead_code_in_apollo_node_config

Conversation

@asaf-sw

@asaf-sw asaf-sw commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What

Removes a stale #[allow(dead_code)] annotation from the VERSION_META constant in crates/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_META 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 pub const VERSION_FULL (version.rs:22), a public entry point.

So VERSION_META is 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 from version_test.rs):

  • Metadata enum / Metadata::Stable variant — Stable is never constructed in non-test code (VERSION_META == Metadata::Dev).
  • metadata_str — only called from version_test.rs.
  • STABLE_VERSION_META — only referenced from the test-only metadata_str.

Removing those would re-introduce dead_code/never constructed warnings, so they stay.

Verification (RUSTC_WRAPPER unset, CARGO_INCREMENTAL=0)

  • scripts/rust_fmt.sh — clean
  • cargo build -p apollo_node_configzero dead_code warnings (default cfg)
  • cargo clippy -p apollo_node_config --all-targets — clean (covers --tests cfg)
  • SEED=0 cargo test -p apollo_node_config — 16 passed, 0 failed

https://claude.ai/code/session_01JySgtGzptZGSVtkdguAaHA


Generated by Claude Code

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
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@asaf-sw asaf-sw requested a review from eitanm-starkware June 6, 2026 05:31
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