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

rustfmt is not skipped for generated mod.rs #621

Closed
hanabi1224 opened this issue May 5, 2022 · 3 comments · Fixed by #622
Closed

rustfmt is not skipped for generated mod.rs #621

hanabi1224 opened this issue May 5, 2022 · 3 comments · Fixed by #622

Comments

@hanabi1224
Copy link
Contributor

After upgrading to v3, the imports in generated mod.rs are no longer in alphabetic order, thus cargo fmt -- --check command fails. Should it also include #![cfg_attr(rustfmt, rustfmt::skip)]? Thanks.

@stepancheg
Copy link
Owner

Unfortunately, adding #![cfg_attr(rustfmt, rustfmt::skip)] will make it impossible to include generated file in source

include!(concat!(env!("OUT_DIR"), "/p/mod.rs"));

There are two options here:

  • sort imports in generated file (PR welcome)
  • specify rustfmt option to skip files marked as @generated

@stepancheg
Copy link
Owner

Reopening until merged to stable branch.

@stepancheg
Copy link
Owner

Done.

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

Successfully merging a pull request may close this issue.

2 participants