Skip to content

Respect --file-lines when making various whitespace-related changes.#6841

Open
martinboehme wants to merge 1 commit intorust-lang:mainfrom
martinboehme:issue-5136
Open

Respect --file-lines when making various whitespace-related changes.#6841
martinboehme wants to merge 1 commit intorust-lang:mainfrom
martinboehme:issue-5136

Conversation

@martinboehme
Copy link
Copy Markdown

@martinboehme martinboehme commented Mar 24, 2026

Various whitespace-related changes did not so far respect --file-lines, see also #5136. This PR fixes this in all of the cases reported in #5136:

  • Newlines at the beginning of the file
  • Spaces at the beginning of the file
  • Missing newline at the end of the file
  • Space after a doc comment
  • Space before a comment in the last line of the file (without trailing newline)

The PR includes tests that fail without the fixes.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Mar 24, 2026
@martinboehme
Copy link
Copy Markdown
Author

martinboehme commented Mar 24, 2026

Edit: Disregard. PR is ready for review now.

Please hold off on reviewing for now. While tests previously passed for me, I see that they are now failing, for reasons that aren't clear to me.

@ytmimi
Copy link
Copy Markdown
Contributor

ytmimi commented Mar 24, 2026

Checking the logs shows that the system_tests and idempotence_tests failed:

test test::system_tests ... FAILED
test test::idempotence_tests ... FAILED

Specifically I see:

Mismatch at tests/source/issue-5136-3.rs:4:
 // Important: When editing this file, make sure not to add a newline at the end
 // of the last line.
 use std;
+
Mismatch at tests/target/issue-5136-3.rs:4:
 // Important: When editing this file, make sure not to add a newline at the end
 // of the last line.
 use std;
+

@martinboehme
Copy link
Copy Markdown
Author

Checking the logs shows that the system_tests and idempotence_tests failed:
...

Yes, thanks. See also my previous comment:

Please hold off on reviewing for now. While tests previously passed for me, I see that they are now failing, for reasons that aren't clear to me.

I'm investigating and will let you know when the PR is ready to review. Sorry for the noise.

@martinboehme
Copy link
Copy Markdown
Author

The issue is now fixed.

I had removed part of the code that I had thought I had convinced myself was not needed -- obviously, this was not the case. I have now reinstated the code, and the tests pass.

@martinboehme
Copy link
Copy Markdown
Author

Since the PR wasn't in review yet, I've modified it to add tests and fixes for the two remaining issues from #5136. The PR is now a complete fix for #5136.

The PR currently consists of multiple commits -- should I squash these into a single commit?

@ytmimi ytmimi self-assigned this Mar 25, 2026
@rustbot

This comment has been minimized.

Various whitespace-related changes did not so far respect
`--file-lines`, see also [rust-lang#5136](tests/target/issue-5136-4.rs). This PR
fixes this in all of the cases reported in rust-lang#5136:

*  Newlines at the beginning of the file
*  Spaces at the beginning of the file
*  Missing newline at the end of the file
*  Space after a doc comment
*  Space before a comment in the last line of the file (without trailing
   newline)

The PR includes tests that fail without the fixes.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 30, 2026

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.

@martinboehme
Copy link
Copy Markdown
Author

I've resolved the merge conflicts and, in the process, squashed the previously multiple commits into one.

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.

3 participants