Fix compilation errors, linting issues, and test failures in the warp Rust codebase. Covers presubmit checks, WASM-specific errors, and running specific tests. Use when the user hits build errors, clippy or fmt failures, test failures, or needs to run or interpret presubmit before a PR.
Fix compilation errors, linting issues, and test failures in the warp Rust codebase.
This skill helps resolve common issues encountered during development, including:
Fix the reported failure with the narrowest useful command. Do not turn a targeted repair into repeated full-workspace validation.
Run the full presubmit only when the user, task, or approved spec explicitly requires it:
./script/presubmitThis runs formatting checks, linting, and all tests. It is intentionally broader and more expensive than the default implementation workflow.
Run checks separately when debugging specific issues:
Rust formatting:
cargo fmt -- --checkClippy (full workspace):
cargo clippy --workspace --all-targets --tests -- -D warningsWASM Clippy:
cargo clippy --target wasm32-unknown-unknown --profile release-wasm-debug_assertions --no-depsObjective-C/C/C++ formatting:
./script/run-clang-format.py -r --extensions 'c,h,cpp,m' ./crates/warpui/src/ ./app/src/All tests:
cargo nextest run --no-fail-fast --workspace --exclude command-signatures-v2
cargo nextest run -p warp_completer --features v2Doc tests:
cargo test --docSingle package:
cargo nextest run -p <package_name>Filter by test name:
cargo nextest run -E 'test(<substring>)'Specific package with filter:
cargo nextest run -p <package_name> -E 'test(<substring>)'With output (no capture):
cargo nextest run -p <package> --nocaptureRemove unused use statements identified by the compiler.
Remove constants that are defined but never used.
Add the correct use statement for undefined types. Search the codebase to find the correct module path.
Update function calls to pass arguments of the correct type. Common fixes:
.as_str() instead of .clone() when a &str is expected&value when a reference is needed.to_string() when String is expected but &str is providedWhen a struct adds/removes fields, update all places where it's constructed or destructured:
match, if let)When a function adds a new parameter, update all call sites to provide the new argument:
bool params: pass true or false based on contextOption<T> params: pass None as default or Some(value) if neededWhen adding a new enum variant, update exhaustive match statements:
Fix trait implementations that return the wrong type or don't satisfy trait bounds.
WASM builds (wasm32-unknown-unknown target) don't support filesystem operations. Code that uses filesystem APIs must be gated behind the local_fs feature flag.
Common WASM errors:
local_fs is availableFixes:
Gate tests behind local_fs:
#[test]
#[cfg(feature = "local_fs")]
fn test_find_git_repo_with_worktree() {
// Test that uses filesystem operations
}Conditionally allow dead code for types only used when local_fs is enabled:
#[cfg_attr(not(feature = "local_fs"), allow(dead_code))]
#[derive(Clone, EnumDiscriminants, Serialize)]
pub enum ExampleType {
// Variants only used when local_fs is enabled
Variant1,
Variant2,
Variant3,
}WASM errors are discovered by running:
cargo clippy --target wasm32-unknown-unknown --profile release-wasm-debug_assertions --no-depsBefore fixing:
local_fsWhen fixing:
cargo check when it helps resolve compiler errors; do not repeat broad checks without a relevant code changeAfter fixing:
cargo nextest tests and fix the code until they pass./script/format once after all other code changes are complete69b4753
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.