fix(proc macros): don't use params as name#1363
Conversation
Because jsonrpsee's internal proc macro code was using `params` it could conflict and with `params` in the user's API in such case it may try to overwrite the "wrong" variable. In this PR I have renamed this internal variable to something much weirder which should be quite unlikely that anyone will use.
|
@CodiumAI-Agent /review |
PR Review
Code feedback:
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
proc-macros/src/render_client.rs
Outdated
| param_kind: &ParamKind, | ||
| signature: &syn::TraitItemFn, | ||
| ) -> TokenStream2 { | ||
| const ILLEGAL_PARAM_NAME: &str = "__________________params"; |
There was a problem hiding this comment.
The only wee thing is that this might provoke some sort of clippy warning about _ being used in front of a variable that's in use, but perhaps not an issue (and you could call it eg jsonrpsee__params or whatever if it was) :)
There was a problem hiding this comment.
I double checked and async trait ignores the let _x = .. warning but I also changed this to camelCase which will be a warning if someone is using it in their API.
I also ignore's to the related lints this to be on the safe-side.
* fix(proc macros): don't use `params` as name Because jsonrpsee's internal proc macro code was using `params` it could conflict and with `params` in the user's API in such case it may try to overwrite the "wrong" variable. In this PR I have renamed this internal variable to something much weirder which should be quite unlikely that anyone will use. * fix nit * allow snake case and underscore * better error message
Because jsonrpsee's internal proc macro code was using
paramsas internal variable name it could conflict and withparamsin the user's API in such case it may try to overwrite the "wrong" variable.In this PR I have renamed this internal variable to something much weirder which should be quite unlikely that anyone will use and panic if those collide to make it easier to debug.
Close #1362