Skip to content

Comments

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

Open
ytmimi wants to merge 1 commit intorust-lang:mainfrom
ytmimi:issue_6568
Open

fix: remove trailing spaces when rewriting same line missing comments#6575
ytmimi wants to merge 1 commit intorust-lang:mainfrom
ytmimi:issue_6568

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).

@jieyouxu jieyouxu added S-waiting-on-review Status: awaiting review from the assignee but also interested parties. and removed pr-not-reviewed labels Feb 19, 2026
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.

Trailing whitespace remains when passing --edition 2024

4 participants