December 2024 Rust-analyzer can expand macros (via)
Rust-analyzer can expand macros (via)
If you use an editor with Rust’s LSP integration, you can put your cursor on a particular derive
macro, such as Clone
in #[derive(Clone)]
, or an the name of a macro application, such as matches!
in matches(foo, bar)
, and select “Expand Macros Recursively”, which will open up a side buffer showing the expanded code from that macro.
This is extraordinarily useful when trying to understand what code is generated from a derive, or when debugging an issue with your own macros.
I discovered this through a comment made by David Barsky in the Rust Zulip.