Skip to content

Pass FIELDS to write! by value in generated Visitors - #159

Closed
u9g wants to merge 1 commit into
influxdata:mainfrom
u9g:fields-borrow
Closed

u9g wants to merge 1 commit into
influxdata:mainfrom
u9g:fields-borrow

Conversation

@u9g

@u9g u9g commented Sep 22, 2026

Copy link
Copy Markdown

Clippy 1.98 adds useless_borrows_in_formatting, which fires on every Visitor the generator writes: &FIELDS where FIELDS is already a &[&str]. Any crate that includes generated code and builds with -Dwarnings fails on it.

Fixes #157.

Checked with cargo +1.98.1 clippy -p pbjson-test --no-deps --all-targets -- -Dwarnings: 16 errors on main, none with this.

Clippy 1.98 adds useless_borrows_in_formatting, which fires on every
Visitor the generator writes: `&FIELDS` where `FIELDS` is already a
`&[&str]`. Any crate that includes generated code and builds with
-Dwarnings fails on it. Fixes influxdata#157.
@u9g

u9g commented Sep 22, 2026

Copy link
Copy Markdown
Author

Duplicate of #158, which predates this and adds tests; closing in its favour. The two CI failures on both are unrelated to the change: cargo install cargo-audit no longer builds on the 1.91 toolchain (kstring needs 1.96), and the vendor job's pbjson-types/descriptors.bin drifts on a fresh build.

@u9g u9g closed this Sep 22, 2026
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.

Generated code triggers clippy::useless_borrows_in_formatting

1 participant