-
Notifications
You must be signed in to change notification settings - Fork 33
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
How to deal with #[warn(clippy::too_many_arguments)]
#44
Comments
Wow, that's a lot of parameters! But even with fewer parameters, I have seen the same problem. So, what should we do? Just add |
https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments says that there is a configuration Another approach may be to simply set |
i think the problem in our case is that the module in question is A submodule thereof is |
I just verified that this workaround works for me: mod foo {
#![allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
}
use foo::templates; A bit ugly, but might be worthwile while we try to figure out a better way to handle things. |
Seems ok to close this. I'll just throw in a note that the dummy module in the above-mentioned workaround don't seem to be needed any more (I don't know why it was needed beore). So the "workaround" can be reduced to: #[allow(clippy::too_many_arguments)]
include!(concat!(env!("OUT_DIR"), "/templates.rs")); ... which doesn't even feel like a workaround, but rather proper clippy configuration. |
I have a kinda similar problem in vbrandl/hoc so I don't know if this requires a new issue, but I think it fits here:
I tried working around that lint: mod workaround {
#[allow(clippy::needless_borrow)]
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
}
use workaround::templates; But this doesn't seem to work anymore:
Is there another way to suppress clippy lints for ructe templates? |
That is separate, and a lint that started to appear on all ructe templates witch rustc / clippy version 1.57. I'm thinking of changing the generated signature to fix it, perhaps as tried in #107 , perhaps in some slightly different way. |
We've recently started a PR to clippy-fy our code Plume-org/Plume#462 and we're hitting some limits in Ructe, with regard to how templates are generated as functions
in our case, as functions with lots of parameters, despite having extracted a BaseContext
Here's an example of such a function: https://github.com/Plume-org/Plume/blob/master/templates/posts/details.rs.html#L12
The text was updated successfully, but these errors were encountered: