Skip to content

Commit

Permalink
Merge pull request #251 from Emilgardis/mention-prettyplease
Browse files Browse the repository at this point in the history
mention prettyplease for formatting generated code
  • Loading branch information
dtolnay committed May 8, 2023
2 parents 2f818f1 + aeceb61 commit 37a0e2e
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 37a0e2e

Please sign in to comment.