Skip to content
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

Double Space between pub and type in newtype when an attribute is followed by a comment #5997

Open
passcod opened this issue Dec 29, 2023 · 2 comments · May be fixed by #5708
Open

Double Space between pub and type in newtype when an attribute is followed by a comment #5997

passcod opened this issue Dec 29, 2023 · 2 comments · May be fixed by #5708

Comments

@passcod
Copy link

passcod commented Dec 29, 2023

This looks related to #4671 but the attribute is not very long at all.

This formats with two spaces:

pub struct Newtype(
    /// Doc
    #[doc()] //
    pub  Vec<u8>,
);

This formats with one:

pub struct Newtype(
    /// Doc
    #[doc()]
    pub Vec<u8>,
);

Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6abf771bd72b8a98d38368badd4916de

@passcod
Copy link
Author

passcod commented Dec 29, 2023

@ytmimi
Copy link
Contributor

ytmimi commented Dec 29, 2023

@passcod thanks for the report. Some background; #4671 was merged into what's now the rustfmt-2.0.0-rc.2 branch, which was never released. You can run git branch -r --contains a9876e8 to confirm that. The current master branch has diverged significantly from rustfmt-2.0.0-rc.2, and the PR is labeled with backport-triage to indicate that the team needs to review how these changes can be brought back into the main development branch.

That being said, I'm pretty sure this is related / is a duplicate of the issues that #5708 is looking to resolve. I've checked and the linked PR resolves this issue and I've added a test case in that PR.

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

Successfully merging a pull request may close this issue.

2 participants