Skip to content

perf(derive): drop proc-macro-crate transitive deps - #1042

Merged
jdx merged 3 commits into
cursor/usage-rs-oob-one-crate-4d80from
cursor/drop-proc-macro-crate-4d80
Aug 19, 2026
Merged

perf(derive): drop proc-macro-crate transitive deps#1042
jdx merged 3 commits into
cursor/usage-rs-oob-one-crate-4d80from
cursor/drop-proc-macro-crate-4d80

Conversation

@jdx

@jdx jdx commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #1041. Drops proc-macro-crate (and its toml_edit / indexmap / winnow tree) from usage-derive so adopters compile a much smaller transitive set.

Approach

Keep rename / mixed-dependency resolution by reading the adopter’s Cargo.toml directly for the forms usage documents:

  • bare keys (usage-argv = …)
  • inline renames (usage = { package = "usage-rs", … })
  • multi-line { … } tables
  • [dependencies.foo] headers

Same priority as before: direct usage-argv wins, otherwise the usage-rs facade.

Tree

Before (under usage-rs): ~17 crates including toml_edit, winnow, indexmap, …

After:

  • usage-rsusage-argv + usage-derive
  • usage-derivesyn / quote / proc-macro2 / unicode-ident

Checks

  • cargo test -p usage-derive (including new crate_name unit tests)
  • cargo test -p usage-rs (facade + cargo-alias + mixed-dependencies fixtures)
  • cargo test -p usage-conformance --test derive --test unit_variants
  • cargo clippy -p usage-derive --all-targets -- -D warnings
  • cargo check -p usage-cli

Stack

Open in Web Open in Cursor 

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: dcf06947-b3f8-4ba8-90e5-83b69a75dc63

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@cursor
cursor Bot force-pushed the cursor/drop-proc-macro-crate-4d80 branch from 04e964c to 391f787 Compare August 18, 2026 18:58
Comment thread derive/src/crate_name.rs
@jdx
jdx marked this pull request as ready for review August 18, 2026 19:05
@cursor
cursor Bot force-pushed the cursor/drop-proc-macro-crate-4d80 branch from 391f787 to 188e21e Compare August 18, 2026 19:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit db26e1b. Configure here.

Comment thread derive/src/crate_name.rs
@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
markdown ▂▃▁▁▂▂▂▁▂███ 196,871,114 → 196,903,399 +0.02% 17.79 → 18.73ms +5.30%
startup █████████▁▁▁ 824,876 → 825,019 +0.02% 0.85 → 0.88ms +3.10%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

Shadow comparison

Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.

framework instructions, cold parse vs usage
usage 4220
argh 6292 1.5x
clap 5895248 1396x
bpaf 21917796 5193x
                                              min       p01       p10    median
usage-rs: argv -> struct                      198       202       205       209  ns
argh: argv -> struct                          296       303       310       316  ns
clap: build tree + parse -> struct         501814    504909    511427    519547  ns
bpaf: build parser + parse -> struct      1612349   1612349   1618650   1642586  ns

usage: argv -> struct                             215 ns      0.22 µs
clap: build tree + parse -> struct             507302 ns    507.30 µs
clap: parse -> struct, tree reused              23881 ns     23.88 µs
clap: build tree only                          309387 ns    309.39 µs

db26e1b4a493 vs 3236b06f3a4c · measured on the runner, not pushed to the history.

cursoragent and others added 3 commits August 19, 2026 00:34
Resolve usage-argv / usage-rs renames by reading the adopter Cargo.toml
directly for the dependency forms usage documents. Removes toml_edit and
friends from every derive compile while keeping the facade alias and
mixed-dependency layouts working.

Co-authored-by: jdx <jdx@users.noreply.github.com>
Cargo's TOML 1.1 multi-line inline tables carry a trailing comma on each
field and may put fields on the opening or closing brace line. The
manifest reader dropped those renames and fell back to ::usage_argv. Read
package fields tolerant of the comma and of the brace position.

Co-authored-by: jdx <jdx@users.noreply.github.com>
@jdx
jdx force-pushed the cursor/drop-proc-macro-crate-4d80 branch from db26e1b to c543534 Compare August 19, 2026 00:43
@jdx
jdx merged commit 8aa13e2 into main Aug 19, 2026
9 of 16 checks passed
@jdx
jdx deleted the cursor/drop-proc-macro-crate-4d80 branch August 19, 2026 00:56
jdx added a commit that referenced this pull request Aug 19, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Summary

Rust framework adopters should depend on **one** Cargo package out of
the box: `usage-rs` (aliased to `usage`). The facade already existed for
that, but it was stuck at the `0.0.0` crates.io placeholder because
`tasks/release-plz` never published it, and defaults omitted
`diagnostics` so friendly errors were a footgun.

## Changes

- Publish `usage-rs` in the release path (after `usage-argv` /
`usage-derive`), and include it in cliff / version bump paths
- Enable `diagnostics` by default on the facade so clap-shaped parse
errors work without an extra feature
- Document the one-dependency install; keep `usage-argv` /
`usage-derive` as the thin low-level split
- Drop the redundant `features = ["diagnostics"]` from `usage-cli`
(defaults cover it)
- Regression test: facade defaults render clap-shaped unknown-flag
errors (plain `Style`, so TTY/`CLICOLOR_FORCE` cannot flake the
assertion)
- CI: apt per-connection timeouts when installing zsh/fish (same fix as
#1036) so stalled azure mirrors do not fail `test`/`coverage`

## Why

Applications were documented to depend on `usage-rs`, but without a
release they effectively needed both `usage-argv` and `usage-derive`.
Shipping the facade closes that gap; turning on diagnostics by default
removes the “Debug-formatted errors until you remember the feature”
footgun. Low-level adopters that want only the binding runtime still use
`usage-argv` directly (no defaults).

## Stack

- **This PR** — one-crate facade defaults + release publish + CI apt
resilience
- #1042 — drop `proc-macro-crate` transitive deps (stacked on this; base
= this branch)

## Checks

- `cargo test -p usage-rs`
- `cargo check -p usage-cli`
- `usage --wat` → clap-shaped error, exit 2
- Bugbot ANSI assertion feedback addressed and thread resolved

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-bfc42df3-e089-48ba-8ca9-86373fb54d80?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-bfc42df3-e089-48ba-8ca9-86373fb54d80&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Rust applications now enable diagnostics, specification, and help
support by default.
* Unknown command-line arguments display clearer, clap-style error
messages with plain styling.
  * Shell completions remain optional and can be enabled separately.

* **Documentation**
* Updated installation and feature guidance to reflect default
capabilities and available lower-level alternatives.
  * Clarified fallback error formatting when diagnostics are disabled.
* Documented feature requirements and configuration options for shell
completions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: jdx <jdx@users.noreply.github.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