GCWing / GCWing/OpenBitFun

[Bug]: unused_mut warning for the browser webview builder in release builds

Offen Anfängerfreundlich
#2,581 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
2.3k
Forks
231
Ø Merge
2 Std. 46 Min.
Gemergte PRs (30 T.)
577

Beschreibung

**Summary**

The desktop crate's browser webview creation path emits an `unused_mut` warning in Windows release builds.

`cargo check --release -p bitfun-desktop` on main reports:

- `src/apps/desktop/src/api/browser_api.rs:145:9` — `unused_mut`: `let mut builder` in `browser_webview_create`, with the note "variable does not need to be mutable".

The `WebviewBuilder` binding is declared `mut` unconditionally, but its only mutating call — `builder.devtools(true)` — is compiled solely under `#[cfg(any(debug_assertions, feature = "devtools"))]`. In a release build without the devtools feature the mutation is compiled out, so the `mut` requirement disappears and the compiler flags the binding. Debug and devtools-enabled builds do not warn, which is why the warning only shows up in release-mode checks.

**Area**

Desktop app

**Reproduction or evidence**

1. On Windows, check out main and run `cargo check --release -p bitfun-desktop`.
2. Observe: `warning: variable does not need to be mutable --> src\apps\desktop\src\api\browser_api.rs:145:9`.
3. Run `cargo check -p bitfun-desktop` (dev profile): the same binding compiles without the warning, since the cfg block is active there.

A scoped fix exists and is ready to submit: shadow the builder inside the cfg block (immutable outer binding + local `mut` rebind), which removes the warning in every build configuration with zero behavior change. PR to follow referencing this issue.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start in src/apps/desktop/src/api/browser_api.rs around line 145, in browser_webview_create, and inspect how the cfg-gated devtools call affects the WebviewBuilder binding. Run cargo check --release -p bitfun-desktop on Windows, then verify the unused_mut warning is gone without changing debug or devtools-enabled behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
desktop
Issue-Typ
Bug
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
88/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.