-
Notifications
You must be signed in to change notification settings - Fork 1.7k
toplevel_ref_arg triggers on macro-generated code #5849
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
Comments
This can be trivially fixed in SQLx, but in general it would be nice to know how we could avoid triggering lint warnings in generated code which the user has no control over. |
cc rust-lang/rust-clippy#5849 Signed-off-by: Austin Bonander <[email protected]>
It's also worth mentioning that this warning was produced with |
cc rust-lang/rust-clippy#5849 Signed-off-by: Austin Bonander <[email protected]>
Depending on what form the macro output takes, you could add an For instance, if the output is an expression, you can wrap the output in a block and add an inner attribute at the top. |
To fix this issue, we can use the For the tests, we should create two macros, and use them:
For example: macro_rules! gen_binding {
() => {
let ref _y = 42;
}
}
macro_rules! gen_function {
() => {
fn fun_example(ref _x: usize) {}
}
} |
Not sure whether this is intended behaviour, but currently pretty much all SQLx
query_as!
invocations trigger this lint, e.g.Meta
cargo clippy -V
:clippy 0.0.212 (6c8927b 2020-07-26)
rustc -Vv
:The text was updated successfully, but these errors were encountered: