Is there any way (even with cargo-expand) to run clippy on macro codegen?
In my project a lot of code is generated through proc-macro and currently the only way to analyze what happens inside is by manually running cargo-expand, stripping all unnecessary code and wrapping things in a test on which cargo clippy is then run.
As a side note, if somebody knows whether it is possible in IDE to expand proc-macros (I mostly use nvim with coc.nvim extension, but I can change LSP) or whether it is possible to feed cargo-expand output to the debugger (I usually use WinDbg, but I can switch), your advice is greatly appreciated!
rust-analyzer has the command “Expand macro recursively at caret” which will open a new editor with the result of expanding the macro. This does not help you actually run it, but may be more convenient to work with than cargo-expand.
(In general, it is not necessarily possible to expand a macro into compilable source code, but most of the caveats in that area apply mostly to declarative macros (hygiene, invisible brackets, $crate), not procedural macros.)