GCWing / GCWing/OpenBitFun

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

クローズ 初心者向け
#2,581 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Rust
スター
2.3k
フォーク
231
平均マージ
2時間 49分
マージ済み PR(30日)
589

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

src/apps/desktop/src/api/browser_api.rs の145行目付近にある browser_webview_create から始め、cfg によって条件付けられた devtools 呼び出しが WebviewBuilder のバインディングにどのような影響を与えるかを調べてください。Windows で cargo check --release -p bitfun-desktop を実行し、debug または devtools-enabled の動作を変更せずに unused_mut 警告がなくなったことを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
desktop
issue の種類
バグ
難易度
1/5
見積もり時間
1時間未満
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
88/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。