-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustfmt.toml
fixes
#125429
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.toml
fixes
#125429
Conversation
I tried some `rustfmt.toml` changes and these files were changed under `tests/run-make`: tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs tests/run-make/compiler-builtins/rmake.rs tests/run-make/cross-lang-lto-riscv-abi/rmake.rs tests/run-make/issue-26006/in/libc/lib.rs tests/run-make/issue-26006/in/time/lib.rs tests/run-make/print-cfg/rmake.rs tests/run-make/print-native-static-libs/rmake.rs tests/run-make/print-to-output/rmake.rs tests/run-make/rustdoc-scrape-examples-invalid-expr/src/lib.rs tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs tests/run-make/rustdoc-scrape-examples-test/examples/ex.rs tests/run-make/thumb-none-qemu/example/src/main.rs tests/run-make/wasm-exceptions-nostd/src/arena_alloc.rs tests/run-make/wasm-exceptions-nostd/src/lib.rs tests/run-make/wasm-exceptions-nostd/src/panicking.rs tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs Only the `rmake.rs` files should have been changed. This commit adjust the rules to initially exclude all files under `tests/run-make/`, not just `tests/run-make/*/*.rs`. Because there are some `.rs` files at deeper depths. After that, the changes I get are to only the desired files: tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs tests/run-make/compiler-builtins/rmake.rs tests/run-make/cross-lang-lto-riscv-abi/rmake.rs tests/run-make/print-cfg/rmake.rs tests/run-make/print-native-static-libs/rmake.rs tests/run-make/print-to-output/rmake.rs
This comment -- "by default we ignore everything in the repository" -- was added in rust-lang#65939 when rustfmt was first being introduced for this repository and (briefly) every directory was ignored. Since then lots of directories have opted in to formatting, so it is no longer true.
"/tests/run-make/*/*.rs", | ||
"/tests/run-make/*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change doesn't work for me locally.
I changed my rustfmt.toml
to yours, than changed the formatting inside a rmake.rs
and than did ./x.py fmt
and while the "formatting modified file ..." message was printed, the file wasn't formatted, without this change it is correctly formatted.
Note that we do some weird handling of rustfmt ignore list in bootstrap, it may be related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the behaviour of these rmake.rs
rules is really weird.
- I was seeing the original problem when I was explicitly listing files to format.
- If you change the style in
rustfmt.toml
majorly (e.g. addimports_granularity = "Item"
) and then runx fmt
, it should do nothing, because no files have changed. But it formats all thermake.rs
files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it might be simpler to update how the rule is implemented in bootstrap to make it more straightforward I think.
This PR is superseded by #125637. |
Two small fixes for
rustfmt.toml
.r? @GuillaumeGomez