Skip to content

fix(interpreter): clippy needless_bool when failpoints is off - #3052

Open
andreaTP wants to merge 1 commit into
everruns:mainfrom
andreaTP:fix/script-plan-needless-bool
Open

andreaTP wants to merge 1 commit into
everruns:mainfrom
andreaTP:fix/script-plan-needless-bool

Conversation

@andreaTP

@andreaTP andreaTP commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What changed

native_context in interpreter/script_plan.rs now returns the negated condition directly instead of if <cond> { return false; } true. No behavior change.

Why

clippy::needless_bool fails with -D warnings for any build that enables experimental_execution_plan without failpoints. CI's cargo clippy --all-targets --all-features enables failpoints, which hides the lint, so CI stays green. Found while linting a wasm32-wasip1 build with --no-default-features --features git,jq,python,typescript,tzdata,experimental_jq,experimental_execution_plan; it reproduces on the host too.

Before / After

cargo clippy -p bashkit --features experimental_execution_plan -- -D warnings

Before:

error: this `if` guard returns a bool literal and is followed by another
   --> crates/bashkit/src/interpreter/script_plan.rs:557:5
    = note: `-D clippy::needless-bool` implied by `-D warnings`
error: could not compile `bashkit` (lib) due to 1 previous error

After: passes clean.

Also passing: cargo clippy --all-targets --all-features -- -D warnings, cargo clippy -p bashkit --no-default-features --lib --tests -- -D warnings, cargo fmt --all --check, and cargo test -p bashkit --features experimental_execution_plan --lib (3213 passed).

Risk

  • Low
  • Pure refactor of one boolean expression; same conditions, same result.

Checklist

  • Tests added or updated (not added: lint-only refactor, existing tests pass)
  • Backward compatibility considered

Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@chaliy

chaliy commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@andreaTP can you please push a commit to retrigger CI? Seems like ready to merge.

clippy::needless_bool flags the `if <cond> { return false; } true` tail
of native_context in any build with experimental_execution_plan but
without failpoints. CI's --all-features clippy enables failpoints and
never sees it.

Return the negated condition directly. No behavior change.
@andreaTP
andreaTP force-pushed the fix/script-plan-needless-bool branch from ddd2db7 to 11d1913 Compare December 4, 2026 13:48
@andreaTP

andreaTP commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

@chaliy done, thank you!

@bashkit-pr-reviewer

Copy link
Copy Markdown

Review summary

Verdict: Looks good — clean lint-only refactor, no behavior change. No findings, no review submitted.

native_context in crates/bashkit/src/interpreter/script_plan.rs changes if <8-term disjunction> { return false; } true into !(<same disjunction>). I verified the condition terms are identical before/after (errexit, nounset, xtrace, NOEXEC, traps, pipe_out, subst_stderr, arith-unbound) and the leading #[cfg(feature = "failpoints")] early-return is untouched, so semantics are preserved and the clippy::needless_bool denial under -D warnings with experimental_execution_plan and without failpoints is resolved as described. The ! binds over the whole parenthesized || chain, so there is no precedence issue; sandbox, error-handling, and execution-plan admission behavior are unaffected.

Context read beyond the diff: native_context plus its caller ProgramRef::eligible (lines 524–576 of script_plan.rs) to confirm the return value is used purely as a boolean gate, and AGENTS.md project rules (no test required for a behavior-preserving lint fix; existing experimental_execution_plan tests cited as passing).

Not reviewed: Nothing in scope — the diff is fully visible (truncated: false, 1 file) and was read in place. No build/test run (per reviewer sandbox limits); relied on the author's reported cargo clippy / cargo test results.

This branch has not been deployed

No deployments
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