Skip to content

fix: don't borrow FIELDS in generated expecting() formatting - #161

Merged
reidkaufmann merged 1 commit into
mainfrom
fix/useless-borrow-fields
Nov 9, 2026
Merged

reidkaufmann merged 1 commit into
mainfrom
fix/useless-borrow-fields

Conversation

@reidkaufmann

Copy link
Copy Markdown
Contributor

Generated expecting() impls pass &FIELDS to write!. FIELDS is already &[&str], and Rust 1.99 clippy flags the extra borrow with useless_borrows_in_formatting in every crate that includes the generated code. Downstream crates currently silence it (e.g. influxdb_iox#16869).

This drops the & in the message and enum generators. With clippy 1.99, pbjson-test goes from 2 warnings for this lint to 0.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 14:55

Copilot AI 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.

🟢 Approval recommended

There are no active review issues for the changes removing redundant borrows from generated Serde expecting() messages.

No open issues 🎉

What changed in this PR

Removes redundant borrows from generated Serde expecting() messages to address Clippy’s useless_borrows_in_formatting warnings without changing formatted output.

Changes:

  • Passes FIELDS directly to write! in both message and enum generators.
File Description
pbjson-build/​src/​generator/​message.rs Removes the extra borrow in generated field-name visitor formatting.
pbjson-build/​src/​generator/​enumeration.rs Removes the extra borrow in generated enum visitor formatting.

Review effort: Balanced

@reidkaufmann

Copy link
Copy Markdown
Contributor Author

All CircleCI jobs fail at the checkout step: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey]. They passed on main at 48ee598 (2025-12-09), and this PR doesn't touch .circleci/. The project's checkout key likely needs to be re-added by a repo admin (CircleCI project settings → SSH Keys → Checkout keys).

@reidkaufmann
reidkaufmann requested a review from mhilton November 6, 2026 14:59
@reidkaufmann
reidkaufmann merged commit 3d254a2 into main Nov 9, 2026
2 of 8 checks passed
@reidkaufmann
reidkaufmann deleted the fix/useless-borrow-fields branch November 9, 2026 18:02
@claude claude Bot mentioned this pull request Nov 10, 2026
1 task
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.

3 participants