Closed
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.
Contributor
Author
Urgau
reviewed
May 23, 2024
Comment on lines
-21
to
+20
| "/tests/run-make/*/*.rs", | ||
| "/tests/run-make/*", |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
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.tomlmajorly (e.g. addimports_granularity = "Item") and then runx fmt, it should do nothing, because no files have changed. But it formats all thermake.rsfiles.
Member
There was a problem hiding this comment.
In this case, it might be simpler to update how the rule is implemented in bootstrap to make it more straightforward I think.
Contributor
Author
|
This PR is superseded by #125637. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small fixes for
rustfmt.toml.r? @GuillaumeGomez