Skip to content

chore: triage dead-code warnings (fields, variants, constants, dead assignments) #854

Description

@TheHypnoo

Roughly 60 dead_code-family warnings remain after the warning-cleanup PR. Each one needs case-by-case judgment between #[allow(dead_code)] (with a one-line comment explaining why) and deletion.

Categories

  • Fields never read — e.g. url, stage, id, algo, description, cancelled, expires_in_secs, estimated_wait_secs, inferred, is_dylib, job_id, module_name, name, new_name, watchos, build.
  • Variants never constructedDynamicPropertyAccess, UnsupportedSyntax, Low.
  • Constants never usedPOINTER_TAG, STRING_TAG, POINTER_MASK, SHORT_STRING_TAG, TAG_MARKER, TRANSITION_CACHE_MASK.
  • Statics/functions never usedCALLBACK_COUNTER, with_base_dir.
  • Dead assignmentsvalue assigned to X is never read and variable X is assigned to, but never used: dep_issues_count, extract_ok, host, hostname, modifiers, n, pathname, removed_count, result_len, user_func_idx.
  • Unused variablesty, promise_resolve.

Why per-site review

Some of these are intentional:

  • NaN-boxing tag constants (POINTER_TAG, STRING_TAG, POINTER_MASK, SHORT_STRING_TAG, TAG_MARKER) are part of the value-encoding contract documented in CLAUDE.md. They may be referenced from documentation, external tooling, or codegen even if rustc doesn't see a direct use.
  • Struct fields can be intentional for binary layout, FFI ABI, or future-feature placeholders.
  • Dead assignments may be a missing read (real bug) or a refactor leftover (safe to remove).

Others are genuine cruft that should just be deleted.

How to approach

For each warning:

  • If the symbol is part of an externally-meaningful contract → #[allow(dead_code)] with a one-line comment explaining why (e.g. // part of the NaN-boxing tag contract, see CLAUDE.md).
  • If the symbol is leftover from a removed feature → delete it.
  • If the warning is a dead assignment, check whether the missing read is a bug or whether the assignment itself is dead.

Site list

Captured from:

cargo build --release 2>&1 | grep -B0 -A1 "is never\|never constructed\|assigned to, but never used\|value assigned to.*never read"

Context

Carved out of the warning-cleanup PR (chore: reduce compile warnings 325 → 125).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions