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

wrap_comments = true breaks markdown tables #4210

Closed
WaffleLapkin opened this issue May 27, 2020 · 2 comments · Fixed by #4214 or #5475
Closed

wrap_comments = true breaks markdown tables #4210

WaffleLapkin opened this issue May 27, 2020 · 2 comments · Fixed by #4214 or #5475
Labels
1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce

Comments

@WaffleLapkin
Copy link
Member

cargo fmt -- --config wrap_comments=true turns this:

/// doc
///
/// Table that is > 80 symbols:
///
/// | table | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
/// |-------|--------------------------------------------------------------------|
/// | val   | x                                                                  |
struct Item;

image

Into this:

/// doc
///
/// Table that is > 80 symbols:
///
/// | table | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/// |
/// |-------|--------------------------------------------------------------------|
/// | val   | x
/// |
struct Item;

image

It's possible to work around this issue by adding #[rustfmt::skip] to the struct (or other documented item), but I think it's a bug anyway.

@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce labels May 28, 2020
ayazhafiz added a commit to ayazhafiz/rustfmt that referenced this issue May 30, 2020
topecongiro added a commit that referenced this issue May 31, 2020
* Don't wrap comments that are part of a table

Closes #4210

* fixup! Don't wrap comments that are part of a table
@calebcartwright calebcartwright added the 1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release label Dec 21, 2020
@Nemo157
Copy link
Member

Nemo157 commented Jul 28, 2022

What is necessary to perform the backport here? If it's just cherry-picking the commits onto another branch I'm willing to do that if you let me know which branch.

@ytmimi
Copy link
Contributor

ytmimi commented Jul 28, 2022

@Nemo157, thanks for your interest. It might be as simple as a cherry-pick, but I don't know. I believe this is the PR #4214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce
Projects
None yet
5 participants