Skip to content

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version = "Two"
use_small_heuristics = "Max"
merge_derives = false

# by default we ignore everything in the repository
# tidy only checks files which are not ignored, each entry follows gitignore style
ignore = [
"/build/",
Expand All @@ -18,7 +17,7 @@ ignore = [
# but we still want to format rmake.rs files in tests/run-make/ so we need to do this
# dance to avoid the parent directory from being excluded
"!/tests/run-make/",
"/tests/run-make/*/*.rs",
"/tests/run-make/*",
Comment on lines -21 to +20
Copy link
Member

@Urgau Urgau May 23, 2024

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.

Copy link
Contributor Author

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. add imports_granularity = "Item") and then run x fmt, it should do nothing, because no files have changed. But it formats all the rmake.rs files.

Copy link
Member

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.

"!/tests/run-make/*/rmake.rs",

# do not format submodules
Expand Down
Loading