GCWing / GCWing/OpenBitFun

[Bug]: Unused/dead-code warnings for all 8 Linux-only symbols in CLI self_update module on Windows builds

Aperta Adatta ai principianti
#2,566 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
2.2k
Fork
229
Merge medio
2h 46m
PR unite (30g)
577

Descrizione

## 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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
build-system, cli
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
88/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.