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

rustfmt deletes comments inbetween semicolons #4018

Closed
CGMossa opened this issue Jan 15, 2020 · 0 comments · Fixed by #4180
Closed

rustfmt deletes comments inbetween semicolons #4018

CGMossa opened this issue Jan 15, 2020 · 0 comments · Fixed by #4180
Labels
a-comments bug Panic, non-idempotency, invalid code, etc.

Comments

@CGMossa
Copy link

CGMossa commented Jan 15, 2020

Two issues I found while messing with this, first

fn main() {
    println!("Hello World! I think rustfmt deletes comments between two semicolons.");
    //if you run rustfmt..
    //these 
    //lines will disappear!
    //delete me!!
    ;
}

See playground.

And rustfmt panics if you have a block-comment inside two semicolons, like

fn main() {
    ;/* rustfmt panics!*/;
}

See playground.

@topecongiro topecongiro added a-comments bug Panic, non-idempotency, invalid code, etc. labels Jan 17, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 17, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 20, 2020
calebcartwright pushed a commit that referenced this issue May 20, 2020
* Preserve comments in empty statements

Closes #4018

* fixup! Preserve comments in empty statements
bradleypmartin pushed a commit to bradleypmartin/rustfmt that referenced this issue May 25, 2020
* Preserve comments in empty statements

Closes rust-lang#4018

* fixup! Preserve comments in empty statements
calebcartwright pushed a commit to calebcartwright/rustfmt that referenced this issue Oct 24, 2020
* Preserve comments in empty statements

Closes rust-lang#4018

* fixup! Preserve comments in empty statements
calebcartwright pushed a commit that referenced this issue Oct 24, 2020
* Preserve comments in empty statements

Closes #4018

* fixup! Preserve comments in empty statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-comments bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants