From aeceb616a7f6c018da7e1ef582d1ae015f2ad64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Mon, 8 May 2023 12:29:04 +0200 Subject: [PATCH] mention prettyplease for formatting generated code --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 74e99ce..65ac3b7 100644 --- a/README.md +++ b/README.md @@ -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