Skip to content

Commit

Permalink
mention prettyplease for formatting generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed May 8, 2023
1 parent 2f818f1 commit aeceb61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -233,15 +233,15 @@ macro.
## Non-macro code generators

When using `quote` in a build.rs or main.rs and writing the output out to a
file, consider having the code generator pass the tokens through [rustfmt]
before writing (either by shelling out to the `rustfmt` binary or by pulling in
the `rustfmt` library as a dependency). This way if an error occurs in the
generated code it is convenient for a human to read and debug.
file, consider having the code generator pass the tokens through [prettyplease] or [rustfmt]
before writing. This way if an error occurs in the generated code it is
convenient for a human to read and debug.

Be aware that no kind of hygiene or span information is retained when tokens are
written to a file; the conversion from tokens to source code is lossy.

[rustfmt]: https://github.com/rust-lang/rustfmt
[prettyplease]: https://github.com/dtolnay/prettyplease

<br>

Expand Down

0 comments on commit aeceb61

Please sign in to comment.