GCWing / GCWing/OpenBitFun

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

Fermée Adaptée aux débutants
#2,566 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
2.3k
Forks
231
Merge moyen
2 h 49 min
PR mergées (30 j)
589

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.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans src/apps/cli/src/self_update.rs et comparez le chemin d’installation Unix avec son stub non-Unix. Vérifiez les exécutions Windows GitHub Actions référencées pour confirmer les huit avertissements, puis vérifiez que le chemin d’installation Linux reste inchangé et que les builds Windows ne signalent plus les avertissements répertoriés concernant les imports inutilisés ou le dead code.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
rust
Domaine
build-system, cli
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
88/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.