GCWing / GCWing/OpenBitFun

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

Abierto Apto para principiantes
#2,566 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
2.3k
Forks
231
Merge medio
2 h 46 min
PR fusionados (30 d)
577

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
build-system, cli
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
88/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.