From 4977837fadce608eb39724f9b2ff4ff36e4540a1 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Wed, 12 Aug 2020 19:18:26 -0500 Subject: [PATCH 1/2] Add Cargo Expand to Macro Debugging Tips --- docs/debugging.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/debugging.md b/docs/debugging.md index aafd3c2e35..e2c67f7346 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -2,5 +2,6 @@ ## Macro Debugging -* Print the final output of a macro using ```cargo rustc --profile=check -- -Zunstable-options --pretty=expanded``` -* Print output during macro compilation using ```eprintln!("hi");``` \ No newline at end of file +- Print the final output of a macro using `cargo rustc --profile=check -- -Zunstable-options --pretty=expanded` + - Alternatively you could install and use [cargo expand](https://github.com/dtolnay/cargo-expand) which adds syntax highlighting to the terminal output. +- Print output during macro compilation using `eprintln!("hi");` From 968fdbba9b0b00302f175e00f93638362cf495a9 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Wed, 12 Aug 2020 19:22:01 -0500 Subject: [PATCH 2/2] Add Note About Cargo Expand Pager --- docs/debugging.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/debugging.md b/docs/debugging.md index e2c67f7346..a704a9d415 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -4,4 +4,5 @@ - Print the final output of a macro using `cargo rustc --profile=check -- -Zunstable-options --pretty=expanded` - Alternatively you could install and use [cargo expand](https://github.com/dtolnay/cargo-expand) which adds syntax highlighting to the terminal output. + - Additionally get pager by piping to `less` ( on Unix systems ): `cargo expand --color always | less -R` - Print output during macro compilation using `eprintln!("hi");`