Skip to content

fix(cli): avoid trailing semicolon in macro expression position - #729

Merged
jdx merged 1 commit into
mainfrom
claude/nightly-semicolon-macros
Jul 20, 2026
Merged

jdx merged 1 commit into
mainfrom
claude/nightly-semicolon-macros

Conversation

@jdx

@jdx jdx commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Goal

Get ahead of future Rust warnings. I ran the project under nightly clippy (1.99.0 / clippy 0.1.99) to surface anything that will bite on future toolchains.

What nightly found

  • Clippy lints: none. Zero new clippy warnings across the workspace.
  • One future-incompatibility lint in our own code: semicolon_in_expressions_from_macros (Tracking Issue for denying trailing semicolons in expression macro bodies rust-lang/rust#79813), already a hard error on nightly. It comes from miette::bail! (which expands to return Err(..);) used as a match-arm tail expression, at:
    • cli/src/cli/complete_word.rs:77
    • cli/src/usage_spec.rs:18
  • One instance in a dependency: nix v0.30.1 build script (transitive via homedirxx). Out of scope here — it clears when homedir/xx bump nix to 0.31.x. Not fixable from this repo without an upstream bump.

Fix

Wrap the two bail! call sites in a block with an explicit trailing semicolon, moving the macro into statement position. miette has no released fix (7.6.0 is latest and still expands with the trailing semicolon), so the fix belongs at the call sites.

Verification

  • cargo +nightly clippy --all --all-features -- -D warnings → clean (only the transitive nix note remains)
  • cargo clippy --all --all-features --fix ... -- -D warnings on stable → no additional changes (CI's mise run render no-diff check stays green)
  • cargo build/cargo test -p usage-cli → pass

This PR was generated by Claude Code.


Note

Low Risk
Mechanical control-flow formatting with no logic or behavior change beyond satisfying a future Rust lint.

Overview
Prepares for Rust’s semicolon_in_expressions_from_macros lint (already an error on nightly) by fixing two miette::bail! call sites used as match-arm tail expressions.

In complete_word.rs and usage_spec.rs, the unsupported-shell arms now use a block { miette::bail!(...); } so the macro expands in statement position instead of as an expression. Runtime behavior is unchanged — still bails with the same message for unknown shells.

Reviewed by Cursor Bugbot for commit 9e04469. Bugbot is set up for automated code reviews on this repo. Configure here.

`miette::bail!` expands to `return Err(..);`. Used as a match-arm tail
expression, that trips the `semicolon_in_expressions_from_macros`
future-incompatibility lint (rust-lang/rust#79813), which is already a
hard error on nightly and will become one on stable. Wrap the two call
sites in a block with an explicit trailing semicolon so the macro sits
in statement position.

This is the only such issue in our own code; a remaining instance in the
transitive `nix` dependency clears when `homedir`/`xx` bump it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jdx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 355765a8-9aa4-4180-b570-43c4b0fa0f64

📥 Commits

Reviewing files that changed from the base of the PR and between 9d93d88 and 9e04469.

📒 Files selected for processing (2)
  • cli/src/cli/complete_word.rs
  • cli/src/usage_spec.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two semicolon_in_expressions_from_macros lint violations that are already hard errors on Rust nightly, by wrapping miette::bail! call sites in explicit blocks so the macro runs in statement position rather than expression position.

  • cli/src/cli/complete_word.rs (line 77) and cli/src/usage_spec.rs (line 18): the _ => catch-all arms each gain a { miette::bail!(...); } block wrapper — minimal, correct, and no behavior change at runtime.
  • The fix is at the call sites because miette 7.6.0 still expands bail! with a trailing semicolon; an upstream fix is out of scope for this repo.

Confidence Score: 5/5

Safe to merge — both changes are purely mechanical call-site wrappers with no runtime behavior change.

Two identical one-liner match arms each gain a block wrapper; the only effect is satisfying the compiler lint. Logic, control flow, error propagation, and output are all unchanged.

No files require special attention.

Important Files Changed

Filename Overview
cli/src/cli/complete_word.rs Wraps the miette::bail! catch-all match arm in an explicit block to move the macro into statement position, fixing the semicolon_in_expressions_from_macros lint.
cli/src/usage_spec.rs Same block-wrapping fix applied to the complete function's shell match arm; the trailing ; after the match expression is pre-existing and correct.

Reviews (1): Last reviewed commit: "fix(cli): avoid trailing semicolon in ma..." | Re-trigger Greptile

@jdx
jdx merged commit 02ccd33 into main Jul 20, 2026
5 of 6 checks passed
@jdx
jdx deleted the claude/nightly-semicolon-macros branch July 20, 2026 19:25
mise-en-dev added a commit that referenced this pull request Jul 21, 2026
### 🐛 Bug Fixes

- **(cli)** avoid trailing semicolon in macro expression position by
[@jdx](https://github.com/jdx) in
[#729](#729)
- **(completion)** write spec cache to private dir instead of
world-writable tmp by [@jdx](https://github.com/jdx) in
[#727](#727)
- **(lib)** remove needless borrows in format args by
[@jdx](https://github.com/jdx) in
[#726](#726)
- **(markdown)** preserve HTML in fenced code blocks by
[@risu729](https://github.com/risu729) in
[#720](#720)
- **(nu)** create completion cache dir with mode 700 and fix home-dir
lookup by [@jdx](https://github.com/jdx) in
[#731](#731)

### 🔍 Other Changes

- remove dtolnay/rust-toolchain action, use runner default rust by
[@jdx](https://github.com/jdx) in
[#724](#724)
- regenerate aube-lock.yaml on renovate branches by
[@jdx](https://github.com/jdx) in
[#728](#728)
- exclude aube-lock.yaml from prettier by [@jdx](https://github.com/jdx)
in [#732](#732)

### 📦️ Dependency Updates

- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#723](#723)
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Jul 22, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [usage](https://github.com/jdx/usage) | patch | `3.5.5` → `3.5.6` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jdx/usage (usage)</summary>

### [`v3.5.6`](https://github.com/jdx/usage/blob/HEAD/CHANGELOG.md#356---2026-07-20)

[Compare Source](jdx/usage@v3.5.5...v3.5.6)

##### 🐛 Bug Fixes

- **(cli)** avoid trailing semicolon in macro expression position by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;729](jdx/usage#729)
- **(completion)** write spec cache to private dir instead of world-writable tmp by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;727](jdx/usage#727)
- **(lib)** remove needless borrows in format args by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;726](jdx/usage#726)
- **(markdown)** preserve HTML in fenced code blocks by [@&#8203;risu729](https://github.com/risu729) in [#&#8203;720](jdx/usage#720)
- **(nu)** create completion cache dir with mode 700 and fix home-dir lookup by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;731](jdx/usage#731)

##### 🔍 Other Changes

- remove dtolnay/rust-toolchain action, use runner default rust by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;724](jdx/usage#724)
- regenerate aube-lock.yaml on renovate branches by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;728](jdx/usage#728)
- exclude aube-lock.yaml from prettier by [@&#8203;jdx](https://github.com/jdx) in [#&#8203;732](jdx/usage#732)

##### 📦️ Dependency Updates

- lock file maintenance by [@&#8203;renovate\[bot\]](https://github.com/renovate\[bot]) in [#&#8203;723](jdx/usage#723)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzIuNiIsInVwZGF0ZWRJblZlciI6IjQzLjI3Mi42IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
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.

1 participant