Skip to content

fix(browser): cfg-gate BrowserPaneSnapshot import for wasm clippy#163

Open
BunsDev wants to merge 2 commits into
mainfrom
fix/wasm-clippy-unused-browser-snapshot-import
Open

fix(browser): cfg-gate BrowserPaneSnapshot import for wasm clippy#163
BunsDev wants to merge 2 commits into
mainfrom
fix/wasm-clippy-unused-browser-snapshot-import

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 28, 2026

Summary

Follow-up to #153. The wasm Formatting + Clippy job failed on main with error: unused import: BrowserPaneSnapshot because snapshot() only references the type inside its #[cfg(not(target_family = "wasm"))] block (the wasm branch returns LeafContents::NetworkLog since there's no WebKit data store to persist on wasm), but the use statement was unconditional.

Test plan

  • cargo clippy --locked --target wasm32-unknown-unknown --profile release-wasm-debug_assertions -- -D warnings (matches CI invocation)
  • Native cargo check -p warp-app --lib — confirm BrowserPaneSnapshot is still resolved in the non-wasm branch

🤖 Generated with Claude Code

The `snapshot()` method only references `BrowserPaneSnapshot` inside its
`#[cfg(not(target_family = "wasm"))]` block (the wasm branch returns
`LeafContents::NetworkLog` since wasm has no WebKit data store to
persist), so the unconditional `use crate::app_state::BrowserPaneSnapshot`
became an unused import on wasm and tripped
`Formatting + Clippy (wasm)` with `-D warnings`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 09:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Cfg-gates the BrowserPaneSnapshot import in browser_pane.rs to non-wasm targets, fixing a wasm clippy unused_import failure since the type is only referenced inside the non-wasm branch of snapshot().

Changes:

  • Split the combined import so LeafContents remains unconditional and BrowserPaneSnapshot is gated behind #[cfg(not(target_family = "wasm"))].

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Original commit on this branch put `LeafContents` before
`BrowserPaneSnapshot`, which failed `cargo fmt --check` on every
platform. rustfmt expects the alphabetical order regardless of the
intervening `#[cfg]` attribute.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants