Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip generated files #3958

Closed
Timmmm opened this issue Dec 9, 2019 · 4 comments · Fixed by #4296
Closed

Add option to skip generated files #3958

Timmmm opened this issue Dec 9, 2019 · 4 comments · Fixed by #4296
Milestone

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Dec 9, 2019

There's a growing de facto standard to mark generated files by putting @generated in a comment at the top of the file. E.g. check the top of Cargo.lock.

It would be great if there were an option to have Rustfmt skip files that contain @generated.

@topecongiro
Copy link
Contributor

I have seen @Generated annotation in Java, but to be honest, I have not seen usages of @generated in the Rust community besides Cargo.lock. @Timmmm Are you aware of any tools/projects that add // @generated comment on generated files?

@Timmmm
Copy link
Contributor Author

Timmmm commented Dec 9, 2019

Capnp does (I added that change). I also have an internal tool that does.

Phabricator supports it and shows files containing @generated as collapsed in diff views by default (you can still expand them). For reference here is the diff that added it to Cargo.lock.

@topecongiro
Copy link
Contributor

Thank you for your information. It seems reasonable to have the option in rustfmt.

@stepancheg
Copy link
Contributor

@generated is a standard way to mark a file as generated in Phabricator.

Would be nice if rustfmt supported that out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants