Skip to content

cargo fmt --all not formatting all files #3341

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

Closed
gnzlbg opened this issue Feb 12, 2019 · 2 comments
Closed

cargo fmt --all not formatting all files #3341

gnzlbg opened this issue Feb 12, 2019 · 2 comments
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 12, 2019

Running cargo fmt all -v in the libc repository (https://github.com/rust-lang/libc) outputs:

[test (2015)] "/libc/libc-test/test/main.rs"
[test (2015)] "/libc/libc-test/test/linux_fcntl.rs"
[test (2015)] "/libc/libc-test/test/cmsg.rs"
[custom-build (2015)] "/libc/build.rs"
[lib (2015)] "/libc/src/lib.rs"
[custom-build (2015)] "/libc/libc-test/build.rs"
rustfmt --edition 2015 /libc/libc-test/test/main.rs /Users/gnzlbg/projects/sideprojects/libc/libc-test/test/linux_fcntl.rs /libc/libc-test/test/cmsg.rs /Users/gnzlbg/projects/sideprojects/libc/build.rs /libc/src/lib.rs /Users/gnzlbg/projects/sideprojects/libc/libc-test/build.rs

and returns success. It appears that most files are not formatted by the tool. Modifying a file like src/unix/solaris/mod.rs to introduce incorrect formatting does not appear to cause cargo fmt to reformat the file.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. a-macros labels Feb 12, 2019
@topecongiro
Copy link
Contributor

topecongiro commented Feb 12, 2019

rustfmt ignores modules defined in cfg_if! because it cannot be parsed as a normal AST.

cc #3253.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Feb 12, 2019

Closing because of a duplicate issue.

@gnzlbg gnzlbg closed this as completed Feb 12, 2019
strangelittlemonkey pushed a commit to strangelittlemonkey/libc that referenced this issue Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants