[Bug]: Unused/dead-code warnings for all 8 Linux-only symbols in CLI self_update module on Windows builds
- Dominant language
- Rust
- Stars
- 2.2k
- Forks
- 229
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 577
Description
## Summary
The upstream CI logs for `main` report a cluster of unused/dead-code warnings in the CLI self-update module. Evidence from GitHub Actions run [33035362609](https://github.com/GCWing/BitFun/actions/runs/33035362609) (job "CLI Tests (windows-latest)"; the same entries repeat across runs 33050974141 and 33047041028):
- `warning: unused import: flate2::read::GzDecoder` --> `src/apps/cli/src/self_update.rs:2:5`
- `warning: unused import: std::io::Cursor` --> `src/apps/cli/src/self_update.rs:8:5`
- `warning: unused import: tar::Archive` --> `src/apps/cli/src/self_update.rs:12:5`
- `warning: constant DEPRECATION_WARNING is never used` --> `src/apps/cli/src/self_update.rs:18:7`
- `warning: function find_package_dir is never used` --> `src/apps/cli/src/self_update.rs:1166:4`
- `warning: function validate_entrypoint_pair is never used` --> `src/apps/cli/src/self_update.rs:1178:4`
- `warning: function validate_plugin_host_resources is never used` --> `src/apps/cli/src/self_update.rs:1201:4`
- `warning: function copy_plugin_host_resources is never used` --> `src/apps/cli/src/self_update.rs:1214:4`
The module only performs a real installation on Linux: `install_archive` (the consumer of all eight symbols) is behind `#[cfg(unix)]`, and a `#[cfg(not(unix))]` stub twin exists. On non-Unix builds (Windows compiles the whole module) rustc therefore reports all eight symbols as unused/dead.
## Root Cause Analysis
- The eight symbols are declared unconditionally but their only consumers live inside the `#[cfg(unix)]` install path (`install_archive` and the validation/upgrade chain reachable only from it).
- On Windows builds the Unix install path is compiled out, so rustc flags the imports/const as unused imports and the functions as dead code. The warnings are structural, not flaky: the same entries appear in every full CI run of `main` (runs 33035362609 / 33050974141 / 33047041028 all reproduce them).
## Proposed Fix
Gate exactly these eight declarations with `#[cfg(unix)]` (imports at lines 2/8/12, the `DEPRECATION_WARNING` const, and the four helper functions), so:
- Windows/non-Unix builds stop emitting the warnings;
- the Linux install path is unchanged (all eight symbols stay available exactly where they are consumed).
No `#[allow(dead_code)]`/`#[allow(unused_imports)]` suppression is involved; the warnings are eliminated by precise cfg gating.
Contributor guide
Research direction
Start in src/apps/cli/src/self_update.rs and compare the Unix install path with its non-Unix stub. Check the referenced Windows GitHub Actions runs to confirm the eight warnings, then verify the Linux install path remains unchanged and that Windows builds no longer report the listed unused imports or dead-code warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100