Announcing dont-expand

Thought I'd share in case anyone else finds this useful. I just published a really simple crate dont-expand which is a bit of a hack to help when debugging macros using cargo expand. The crate provides macros with the same names as those found in std which can be imported to shadow those macros. The imported macros intentionally do almost^ nothing with the idea of hiding the output of the common macros so that it's easier to see the expansion of custom macros. The dummy macros don't currently try to replicate the behavior of the std macros in any way so your code likely won't compile when using the macros since it will be as if you didn't include the macro at all in your code.

^For non-derive macros, it does output a string literal which hopefully shows the macro call so that it's still visible.

1 Like