You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/01/23 15:16:44 UTC
[PR] minor: use format!() for placeholder string construction [datafusion-sqlparser-rs]
andygrove opened a new pull request, #2178:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2178
## Summary
Replace `String::from() + &str` concatenation with `format!()` macro for placeholder token construction.
**Before:**
```rust
Token::Placeholder(String::from("?") + &s)
Token::Placeholder(String::from("$") + &value)
```
**After:**
```rust
Token::Placeholder(format!("?{s}"))
Token::Placeholder(format!("${value}"))
```
The `format!()` macro calculates the required capacity upfront and allocates once, avoiding potential reallocation when the appended string exceeds the initial small capacity of `String::from("?")`.
## Test plan
- [x] All existing tests pass
- [x] `cargo clippy` passes
🤖 Generated with [Claude Code](https://claude.ai/code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] minor: reduce unnecessary string allocations [datafusion-sqlparser-rs]
Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio merged PR #2178:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2178
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org