Skip to content

Fix Issue 6470: Preserve Space after colon if followed by absolute path declaration (::)#6475

Open
FwP-IDN wants to merge 21 commits into
rust-lang:mainfrom
FwP-IDN:issue-6470-dont-delete-white-space-on-triple-colon
Open

Fix Issue 6470: Preserve Space after colon if followed by absolute path declaration (::)#6475
FwP-IDN wants to merge 21 commits into
rust-lang:mainfrom
FwP-IDN:issue-6470-dont-delete-white-space-on-triple-colon

Conversation

@FwP-IDN
Copy link
Copy Markdown
Contributor

@FwP-IDN FwP-IDN commented Feb 12, 2025

Close #6470

@FwP-IDN FwP-IDN changed the title add change, and testcase Fix Issue 6470: Preserve Space after colon if after space is absolute path crate declaration Feb 12, 2025
@FwP-IDN FwP-IDN changed the title Fix Issue 6470: Preserve Space after colon if after space is absolute path crate declaration Fix Issue 6470: Preserve Space after colon if followed by absolute path declaration (::) Feb 13, 2025
Comment thread src/items.rs Outdated
Comment on lines +2297 to +2323
result.push_str(colon_spaces(context.config));
result.push_str(colon_spaces(context.config, false));
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 you explain why we can pass false here? It would also be helpful if you could add an explanation to the other call sites where you've passed false.

Comment thread tests/source/issue-6470/case-1.rs
Comment thread tests/source/issue-6470/case-1.rs
Copy link
Copy Markdown
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Another cases that we should test:

fn func<T: ::some::Trait>(x: T) {}

@FwP-IDN FwP-IDN requested a review from ytmimi February 18, 2025 17:46
@jieyouxu jieyouxu added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-follow-up-review-pending 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 can generate invalid code when using space_after_colon=false

4 participants