fix(clippy): platform-specific dead_code on Windows + wasm#159
Merged
Conversation
PR #157's first heavy CI run validated the Linux clippy fix (passes green) but surfaced two additional platform-specific lints that Linux didn't trigger: - cast_agent/src/comux.rs: gate `ListPanesRequest` and `ListPanesResponse` to `#[cfg(unix)]` to match the only call site (the unix-only block at line 96). On Windows the structs compiled but no constructor existed, so dead_code fired. - warp_cli/src/lib.rs: split the `std::ffi::OsString` import out of the unconditional `use std::{env, ffi::OsString, ...}` line and gate it to `#[cfg(not(target_family = "wasm"))]`, matching the three OsString-using helpers that are already wasm-gated. No behavioural changes; just import + cfg housekeeping. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
rustfmt sorts imports lexically with attributes attaching to their
import. My split of `std::ffi::OsString` out of the unconditional
`use std::{env, ffi::OsString, fmt, path::Path};` line landed in the
wrong order:
use std::{env, fmt, path::Path};
#[cfg(not(target_family = "wasm"))]
use std::ffi::OsString;
rustfmt wants the cfg-gated single-item use first:
#[cfg(not(target_family = "wasm"))]
use std::ffi::OsString;
use std::{env, fmt, path::Path};
Linux/Windows/wasm fmt jobs all caught this on the first CI run.
Clippy itself is fine — only fmt needed the reorder.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two more wasm-only clippy errors surfaced once #157's main-side fmt fixes shipped: - crates/lsp/src/model.rs: split `LspStartupError` out of the unconditional `use ... supported_servers::{...}` group. The only usage (the downcast inside `LspServerModel::start`) is already `#[cfg(not(target_arch = "wasm32"))]`; the import is now too. - crates/lsp/src/supported_servers.rs: gate `LspStartupError::missing_binary` to non-wasm too. It's the only constructor of `LspStartupError`, and only `start` calls it, so on wasm the function was unused. No behavioural changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tem use Same rustfmt ordering rule as in warp_cli/src/lib.rs: a cfg-gated single-item `use` should come before the unconditional multi-item group. CI fmt caught this on the previous push. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The browser pane and a handful of related helpers compile on wasm but
no caller exercises them there (wry has no wasm backend; tweakcn
imports require `local_fs`; the git label helper is local_fs-only).
Result: ~15 wasm-clippy dead_code errors that don't fire on Linux or
Windows.
Three different fixes, picked per file:
1. Module-level `#![cfg_attr(target_family = "wasm", allow(dead_code))]`
on the browser scaffolding that has no wasm consumer:
- browser/find.rs (the FIND_SCRIPT JS strings + helpers)
- browser/persistence.rs (state_path / load / save)
- browser/browser_model.rs (BrowserState, TabSnapshot,
BROWSER_STATE_VERSION, snapshot/restore)
- browser/webview_host.rs (detach_native and friends)
- browser/browser_view.rs (the `model` accessor and the
`persistence` import); also `unused_imports` since
`super::persistence` is unused on wasm.
2. Feature-gated imports in settings_view/import_theme_modal.rs:
CustomTheme, write_imported, GamutPolicy are only used from inside
the `#[cfg(feature = "local_fs")]` block at line 162, so gate the
imports the same way. (CustomTheme import alphabetized before
ThemeKind to satisfy rustfmt's group ordering.)
3. Feature-gated function in terminal/view/tab_metadata.rs:
`compute_git_label_from_paths` is only called from the
`#[cfg(feature = "local_fs")]` block in current_git_label; tests
still need it on all platforms, so `#[cfg(any(feature = "local_fs",
test))]`.
No behavioural changes. Local `cargo fmt --check` clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
f72bdc3 to
59e9f9b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Round 3 of the heavy-CI clippy fallout. PR #157 landed the Linux clippy fixes and main is now green for Linux `Formatting + Clippy`. But the Windows + wasm clippy jobs still fail on two platform-specific lints that Linux didn't trigger.
This was originally pushed as commit `b8345389` on `fix/cargo-fmt-on-main` after PR #157's CI surfaced these but before PR #157 was admin-merged at `cf52100b` — so it landed on the now-merged branch instead of main. Cherry-picked here onto fresh main.
No behavioural changes.
Test plan
🤖 Generated with Claude Code