diff options
| author | Seiichi Uchida <seuchida@gmail.com> | 2020-07-10 11:23:12 +0900 |
|---|---|---|
| committer | Caleb Cartwright <calebcartwright@users.noreply.github.com> | 2021-09-14 21:22:26 -0500 |
| commit | d4ffd1efa4c83084f05f6e83585ae0a70450bcfd (patch) | |
| tree | d44f5cb3e989ba0a9eb6c1fef730ec807fac96f3 /tests/incremental/thinlto | |
| parent | 67a59f6ee35c3cfd75e2aab5a8475608e167840b (diff) | |
| download | rust-d4ffd1efa4c83084f05f6e83585ae0a70450bcfd.tar.gz rust-d4ffd1efa4c83084f05f6e83585ae0a70450bcfd.zip | |
Support @generated marker to skip code formatting
This is a copy of #4296 with these changes: * file is not reopened again to find if the file is generated * first five lines are scanned for `@generated` marker instead of one * no attempt is made to only search for marker in comments `@generated` marker is used by certain tools to understand that the file is generated, so it should be treated differently than a file written by a human: * linters should not be invoked on these files, * diffs in these files are less important, * and these files should not be reformatted. This PR proposes builtin support for `@generated` marker. I have not found a standard for a generated file marker, but: * Facebook [uses `@generated` marker](https://tinyurl.com/fb-generated) * Phabricator tool which was spawned from Facebook internal tool [also understands `@generated` marker](https://git.io/JnVHa) * Cargo inserts `@generated` marker into [generated Cargo.lock files](https://git.io/JnVHP) My personal story is that rust-protobuf project which I maintain was broken twice because of incompatibilities/bugs in rustfmt marker handling: [one](https://github.com/stepancheg/rust-protobuf/issues/493), [two](https://github.com/stepancheg/rust-protobuf/issues/551). (Also, rust-protobuf started generating `@generated` marker [6 years ago](https://git.io/JnV5h)). While rustfmt AST markers are useful to apply to a certain AST elements, disable whole-file-at-once all-tools-at-once text level marker might be easier to use and more reliable for generated code.
Diffstat (limited to 'tests/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions
