Skip to content

Let empty files be empty files (reprise) - #6940

Open
notpeter wants to merge 10 commits into
rust-lang:mainfrom
notpeter:empty_files_again
Open

notpeter wants to merge 10 commits into
rust-lang:mainfrom
notpeter:empty_files_again

Conversation

@notpeter

@notpeter notpeter commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Starting with Style Edition 2027, rustfmt leaves an empty formatted file at zero bytes instead of adding a final newline.

Style Edition 2024 and earlier retain the existing behavior of formatting an empty file as a single newline.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Jun 12, 2026
@ytmimi

ytmimi commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@notpeter can you remind me why we're repurposing the */reorder_module tests for this PR and creating */reorder_module_2027? Is reordering the mods related to these whitespace changes? I'm a little confused by that right now.

Wouldn't it make more sense to create some new distinct test cases for what we're working on.

@ytmimi ytmimi self-assigned this Jun 12, 2026
@notpeter

Copy link
Copy Markdown
Contributor Author

When I was doing that PR, I was really bummed when it felt appropriate to duplicate the tree. In this PR, I've now switched from duplicated versions and instead added rustfmt-skip_children for the 2027 reorder tests. This way it will not attempt to reformat all the fixtures (which are empty files with newlines) and the rest of reorder_modules retains coverage under StyleEdition 2027. I think that leads to a simpler/clearer PR without having to duplicate a tree of dozens of empty files.

@ytmimi ytmimi Jun 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid making any changes to the reorder_modules test cases. It's still not clear to me why we're updating these existing test cases. I think we should create new distinct test cases that don't modify any of the old tests.

View changes since the review

@ytmimi

ytmimi commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Jun 12, 2026
@rustbot

rustbot commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

rustbot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@notpeter

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. labels Sep 10, 2026
@notpeter
notpeter requested a review from ytmimi September 14, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustfmt fails on an empty file; --check's diff doesn't result in properly formatted file

3 participants