-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -210,6 +210,8 @@ impl RpcDescription { | |||
param_kind: &ParamKind, | |||
signature: &syn::TraitItemFn, | |||
) -> TokenStream2 { | |||
const ILLEGAL_PARAM_NAME: &str = "__________________params"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
params
as internal variable name it could conflict and withparams
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 and panic if those collide to make it easier to debug.
Close #1362