Skip to content

fix(desktop): drop stale unused_mut allow - #2584

Open
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-appearance-mut
Open

fix(desktop): drop stale unused_mut allow#2584
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-appearance-mut

Conversation

@1688mengdie

Copy link
Copy Markdown

Summary

The main window builder binding in appearance.rs carries an #[allow(unused_mut)] attribute, but the allow can never fire: the builder is unconditionally reassigned via disable_drag_drop_handler() on every platform (appearance.rs:610), with further reassignments in the macos and windows cfg blocks. With the mutability genuinely consumed on all targets, the suppression is dead weight that hides future regressions — if a later change ever removed all mutating uses of this binding, the attribute would silence the unused_mut warning that should have caught it. This PR deletes the attribute; the binding and all consumers are unchanged.

Fixes #2582

Type and Areas

Type: Bug fix

Areas: Rust core (desktop, main window lifecycle)

Motivation / Impact

An inert #[allow] on a hot path like main window creation is not cosmetic: it disables a compiler check for that binding indefinitely. Removing it restores the check's coverage at zero behavior cost — the attribute provably has nothing to suppress today (removing it surfaces no warning on any profile we can run), so the change is semantics-free while re-arming the lint for future regressions.

Verification

Scope note (assertion form): this branch is based on main, which carries one pre-existing unused_mut warning in src/apps/desktop/src/api/browser_api.rs:145 (fixed by a separate PR). The assertion for this change is therefore "zero warnings for the touched binding/file + no new warnings beyond that known pre-existing one", not a bare "0 warnings":

  • cargo check --release -p bitfun-desktop --jobs 4 with this branch: exits 0; the only reported warning is the pre-existing browser_api.rs:145 one from main — appearance.rs surfaces nothing after the attribute removal.
  • cargo check -p bitfun-desktop --jobs 4 (dev profile): 0 errors, 0 warnings.
  • Reproduce: delete the attribute on main and rerun the release check — no new warning appears, proving the allow was suppressing nothing.
  • The macos/windows cfg-block surfaces and unix builds are n/a locally (Windows machine) and are covered by the CI platform matrix.

AI-assisted change, lightly tested.

Reviewer Notes

  • Deletion-only (-1 line); the binding, its reassignments, and builder.build() are untouched, so there is no behavior change on any platform.
  • The value here is lint coverage: with the stale allow gone, unused_mut is armed again for this binding. If reviewers prefer, an alternative is restructuring the builder chain, but the attribute removal is the minimal, semantics-free fix.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (Not applicable: no user-facing change.)

The main window builder binding in appearance.rs carries an
#[allow(unused_mut)] attribute, but the allow can never fire: the
builder is unconditionally reassigned via disable_drag_drop_handler()
on every platform, with further conditional reassignments in the macos
and windows cfg blocks. With the mutability genuinely consumed on all
targets, the suppression is dead weight that hides future regressions.

Remove the attribute; the binding and all consumers are unchanged.

Test: cargo check --release -p bitfun-desktop --jobs 4 (0 errors 0 warnings; no new warning surfaces after removal)
Test: cargo check -p bitfun-desktop (dev profile, 0 errors 0 warnings)

AI: This commit was authored with AI assistance; checks were run locally on Windows (release + dev profiles) and non-Windows compilation surfaces are to be confirmed by the upstream multi-OS CI matrix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: stale allow(unused_mut) on the main window builder hides future regressions

1 participant