Skip to content

chore: fix the clippy lints that fail lint on main - #1666

Merged
jdx merged 2 commits into
mainfrom
fix/clippy-duplicated-attrs
Nov 20, 2026
Merged

jdx merged 2 commits into
mainfrom
fix/clippy-duplicated-attrs

Conversation

@jdx

@jdx jdx commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

mise run lint (cargo clippy --all --all-features --all-targets -- -D warnings) fails on main and on every branch cut from it since a newer clippy started reporting four lints. This is what turned the Renovate PRs red (for example #1664, whose own change was fine). No behaviour changes.

  • clippy::new_instead_of_clear in lib/src/docs/layout.rs: current_line = String::new() becomes current_line.clear(), which keeps the allocation.
  • clippy::unnecessary_box_pin in conformance/tests/dispatch_async.rs, dispatch_async_stack.rs and usage-rs-tests/tests/facade.rs: Box::pin(future) becomes std::pin::pin!(future).
  • clippy::duplicated_attributes in the generated shadow crates: the generator spells a flag's aliases as repeated long = ... / short = ... entries (for example #[usage(long = "tail", long = "follow", short = 't', short = 'f')] in the pitchfork shadow), which the lint flags. That repetition is how aliases are written, so the generator now emits clippy::duplicated_attributes in each shadow's crate-level #![allow(...)], and the twelve generated lib.rs files carry the one-line change.

Validation: the CI clippy command passes locally, as do cargo test -p xtask -p usage-lib -p usage-conformance --all-features (1679 tests) and the facade tests in usage-rs-workspace-tests. The same two lints in layout.rs and the pitchfork shadow fail on origin/main too, confirmed with a baseline run.

🤖 Generated with Claude Code

AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: unavailable.


Note

Low Risk
Lint-only and test-helper tweaks with no production behavior or security impact.

Overview
Restores a clean cargo clippy run on main by addressing three lints—no runtime behavior changes.

In docs layout word-wrapping, line buffers are reset with current_line.clear() instead of String::new() so the existing allocation is reused (clippy::new_instead_of_clear).

Test helpers in async dispatch and facade tests pin futures with std::pin::pin!(future) rather than Box::pin, and the stack-dispatch test comment is updated to match (clippy::unnecessary_box_pin).

Shadow benchmark crates legitimately repeat long/short attributes for CLI aliases; xtask’s gen-shadow output now includes clippy::duplicated_attributes in the crate-level #![allow(...)], and all regenerated shadow lib.rs files pick up that one-line change.

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

Summary by CodeRabbit

  • Chores
    • Updated benchmark and test tooling to accommodate additional lint checks.
    • Reduced heap allocation when pinning futures in test helpers; polling and completion behavior remain unchanged.
    • Improved reuse of text-formatting buffers without changing the resulting output.
    • These changes affect development and test tooling; they do not change user-facing behavior.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M7V9YJNT85W588S71VNAFQP7
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This pull request adds a Clippy lint allowance to shadow crates, changes test helpers to pin futures on the stack, and updates wrap_text to reuse its line buffer.

Changes: Shadow crate lint allowances

Layer / File(s) Summary
Allow duplicated attributes in shadow crates
xtask/src/shadow.rs, benches/shadows/*/src/lib.rs
The generated crate header and shadow crate lint attributes allow clippy::duplicated_attributes.

Stack-pinned test futures

Layer / File(s) Summary
Pin test futures on the stack
conformance/tests/dispatch_async.rs, conformance/tests/dispatch_async_stack.rs, usage-rs-tests/tests/facade.rs
block_on and run_ready use std::pin::pin! instead of Box::pin. Their polling behavior remains unchanged. The documentation describes stack pinning for the small outer future.

Text wrapping buffer reuse

Layer / File(s) Summary
Reuse the wrapped-line buffer
lib/src/docs/layout.rs
wrap_text clears the existing string buffer after emitting a wrapped line.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • jdx/usage#1610: Reports a clippy::duplicated_attributes failure in the pitchfork shadow crate, which this pull request addresses by allowing the lint.
  • jdx/usage#1609: Reports the same lint failure in the pitchfork shadow crate, which this pull request addresses by allowing the lint.
Merge Risk: Minimal · up to d95fd

This PR only fixes Clippy lints and changes no behavior. It allows clippy::duplicated_attributes in the shadow crates, pins test futures on the stack, and reuses a string buffer in text wrapping. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "chore: fix the clippy lints that fail lint on main" matches the main change. The PR fixes four newer Clippy lints that made the lint step fail on main. The changes cover the duplicated_attr…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "chore: fix the clippy lints that fail lint on main" matches the main change. The PR fixes four newer Clippy lints that made the lint step fail on main. The changes cover the duplicated_attributes allowances in the generated shadow crates and the xtask generator, the Box::pin to std::pin::pin! swaps in the async tests and run_ready, and the String::new() to clear() change in lib/src/docs/layout.rs. The title does not name each lint, but it refers to the real and primary change.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d7c7159-0707-492d-ac1a-dff7c28f72ea
Commits

Reviewing files that changed from the base of the PR and between c2c1bd7 and d95fd7f.

Files selected for processing: 1

  • conformance/tests/dispatch_async_stack.rs
Files skipped from review as they are similar to previous changes: 1

  • conformance/tests/dispatch_async_stack.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

This PR fixes Clippy warnings without intended user-facing changes.

  • Help wrapping reuses its line buffer between wrapped lines.
  • Test helpers pin futures on the stack instead of heap-boxing them.
  • Generated shadow crates allow Clippy’s repeated-attribute lint.

The previous finding is fixed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "chore: correct the block_on comment afte..." · Reviewed by Greptile

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M7VA8FFK080P57VRQF3C4ACA
@jdx
jdx enabled auto-merge (squash) November 20, 2026 01:50
@jdx
jdx merged commit 327054f into main Nov 20, 2026
15 checks passed
@jdx
jdx deleted the fix/clippy-duplicated-attrs branch November 20, 2026 02:00
@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
markdown ▅▂▃█▅▄▅▄▁▆▅▅▇▃▃ 269,877,276 → 269,873,320 -0.00% 47.07 → 47.05ms -0.03%
startup ▅▅▅▅▅▅▅▃▃▅▅▅▇▁█ 1,014,021 → 1,020,843 +0.67% 1.51 → 1.48ms -1.74%

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 stripped binary, bytes
usage 1254888
bpaf 2493728
clap 3079624
framework instructions, cold parse vs usage
usage 8497 —
clap 6517879 767x
bpaf 21908898 2578x
                                              min       p01       p10    median
usage-rs: argv -> struct                      755       762       770       784  ns
clap: build tree + parse -> struct        1289582   1292624   1303392   1319526  ns
bpaf: build parser + parse -> struct      3403530   3403530   3471237   3495358  ns

usage: argv -> struct                             912 ns      0.91 µs
clap: build tree + parse -> struct            1319694 ns   1319.69 µs
clap: parse -> struct, tree reused              50716 ns     50.72 µs
clap: build tree only                          817997 ns    818.00 µs

d95fd7f3e6a4 vs 2d884bb8182d · measured on the runner, not pushed to the history.

mise-en-dev added a commit that referenced this pull request Nov 23, 2026
### 🐛 Bug Fixes

- **(fish)** keep backslashes in run= commands of embedded completion
specs by [@jdx](https://github.com/jdx) in
[#1659](#1659)
- **(powershell)** offer subcommands instead of files after a trailing
space by [@jdx](https://github.com/jdx) in
[#1672](#1672)
- **(spec)** emit valid kdl choices from cobra by
[@jdx](https://github.com/jdx) in
[#1670](#1670)

### 🛡️ Security

- **(deps)** update mise tools by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1663](#1663)

### 🔍 Other Changes

- **(entire)** remove trail runners by [@jdx](https://github.com/jdx) in
[a5dc9df](a5dc9df)
- fix the clippy lints that fail lint on main by
[@jdx](https://github.com/jdx) in
[#1666](#1666)

### 📦️ Dependency Updates

- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1665](#1665)
- update dependency effect to v4.1.4 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1661](#1661)
- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1667](#1667)
- update module github.com/spf13/pflag to v1.1.0 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1664](#1664)
- update github actions by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1662](#1662)
- update jdx/mise-action action to v5.2.8 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#1668](#1668)
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