mirror of
https://gitee.com/openharmony/third_party_rust_quote
synced 2024-11-27 09:20:35 +00:00
Further little alert about non-macro generation
This commit is contained in:
parent
7c8e842521
commit
dcee953c63
@ -232,12 +232,15 @@ macro.
|
||||
|
||||
## Non-macro code generators
|
||||
|
||||
When using `quote` in a build.rs or main.rs and writing the output out to a
|
||||
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.
|
||||
|
||||
Obviously, no kind of hygiene or span information is preserved when writing the
|
||||
output to a file.
|
||||
|
||||
[rustfmt]: https://github.com/rust-lang/rustfmt
|
||||
|
||||
<br>
|
||||
|
Loading…
Reference in New Issue
Block a user