Skip to content

fix: omit trailing next_placeholder increment after last param#15

Merged
jrandolf merged 1 commit intomainfrom
fix/unused-assignment-last-slice
Apr 22, 2026
Merged

fix: omit trailing next_placeholder increment after last param#15
jrandolf merged 1 commit intomainfrom
fix/unused-assignment-last-slice

Conversation

@jrandolf
Copy link
Copy Markdown
Contributor

Summary

  • Generated slice-replacement code ended with next_placeholder += slice_len (or += 1) even for the final param, producing a dead store that trips unused_assignments in downstream crates.
  • Emit the increment only when a later param will consume it; drop mut when there is a single param; skip the declaration entirely for zero-param queries.
  • Snapshots updated.

Test plan

  • cargo test (snapshot + postgres integration)

The generated slice-replacement code ended with `next_placeholder +=
slice_len` (or `+= 1`) even when no further params followed, producing
a dead store that triggered `unused_assignments` in downstream crates.
Emit the increment only for non-final params, and drop `mut` on the
counter when there is a single param. Also skip the declaration entirely
for zero-param queries.
@jrandolf jrandolf merged commit 6bb1b7e into main Apr 22, 2026
2 checks passed
@jrandolf jrandolf deleted the fix/unused-assignment-last-slice branch April 22, 2026 12:16
jrandolf added a commit that referenced this pull request Apr 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.7](v0.1.6...v0.1.7)
(2026-04-22)


### Bug Fixes

* Omit trailing next_placeholder increment after last param
([#15](#15))
([6bb1b7e](6bb1b7e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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