Skip to content

fix: remove trailing spaces when rewriting same line missing comments #6575

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ytmimi
Copy link
Contributor

@ytmimi ytmimi commented Jun 10, 2025

Fixes #6568

When using style_edition=2024 trailing whitespace was not properly removed when foramtting same line comments.

Fixes 6568

When using `style_edition=2024` trailing whitespace was not properly
removed when foramtting same line comments.
@calebcartwright
Copy link
Member

i think we may need to gate this behind 27, as annoying as that would be.

thoughts?

@ytmimi
Copy link
Contributor Author

ytmimi commented Jun 10, 2025

The thought crossed my mind. though I think the caveats in our stability guarantee cover us here. I think either the note about comments or bugs would apply.

To quote what we have in the README (emphasis mine):

The following list enumerates areas where Rustfmt does not work or where the stability guarantees do not apply (we don't make a distinction between the two because in the future Rustfmt might work on code where it currently does not):

  • a program where any part of the program does not parse (parsing is an early stage of compilation and in Rust includes macro expansion).
  • Macro declarations and uses (current status: some macro declarations and uses are formatted).
  • Comments, including any AST node with a comment 'inside' (Rustfmt does not currently attempt to format comments, it > does format code with comments inside, but that formatting may change in the future).
  • Rust code in code blocks in comments.
  • Any fragment of a program (i.e., stability guarantees only apply to whole programs, even where fragments of a program can be formatted today).
  • Code containing non-ascii unicode characters (we believe Rustfmt mostly works here, but do not have the test coverage or experience to be 100% sure).
  • Bugs in Rustfmt (like any software, Rustfmt has bugs, we do not consider bug fixes to break our stability guarantees).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailing whitespace remains when passing --edition 2024
3 participants