Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get cargo-expand to expand macros within macros

I’m learning Rust and am trying to use cargo-expand on the default Hello, World program. From what I understand it’s supposed to expand all the macros, but when I use it, it leaves in a macro that another macro generates.

output

From what I understood, the output of cargo expand should expand everything, so I’m a little confused. I tried googling and searching for an answer but everything I read showed no macros within the output.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is this right or not?

>Solution :

If you mean the format_args!, I’ll quote dtolnay (the cargo-expand maintainer) from this issue:

This is working correctly. format_args does not expand to Rust code. (In the past it used to.)

Cargo-expand does recursively expand macros. Just in this case it can’t.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading