Open dsemi opened 4 months ago
Uhm, does clippy
normally give warnings from code generated by macros in external crates? That seems... excessive? Did you enable any particular options?
It seems so: https://github.com/rust-lang/rust-clippy/issues/702. I don't understand why that decision was made.
This comment suggests that it's due to our use of spans in the stack!
macro to improve error messages. We should fix this by just plastering #[allow(clippy::all)]
in the macro-generated code.
I'm not sure off the top of my head if we can put these attributes on code blocks though (not a function/impl block).
We should fix this by just plastering
#[allow(clippy::all)]
in the macro-generated code.
I would absolutely not do that. That will suppress all future clippy lints, some of which might be useful.
i think the (reasonable) options are:
I'm not even sure how option 3. would work to be honest.
@danieleades: appreciate your input. However, in my 8 years of working with Rust, I've never seen clippy actually point out a real problem or bug, but I've seen plenty of energy and time spent by maintainers and contributors fixing clippy complaints. I don't consider it likely that clippy will uncover an actual bug in the future inside this generated code. I personally find it a better trade-off to just ignore clippy entirely within the generated code, so we don't land back into the same situation if/when clippy gets a new lint that the generated code may trigger.
I've never seen clippy actually point out a real problem or bug
I absolutely have. Though generally related to (ab)use of static items, synchronisation primitives, etc. There's nothing like that in this code so I definitely take your point
I've seen plenty of energy and time spent by maintainers and contributors fixing clippy complaints
yep.
I had a look at the code for stack!
and it's not doing anything wild, so while suppressing all lints is an awfully big hammer, it's possibly justifiable here
This line triggers the
clippy::toplevel_ref_arg
warning for users ofstack!
.Example warning: