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

Trailing blank line removal in doc comments is not idempotent #6168

Open
overhacked opened this issue May 21, 2024 · 0 comments · May be fixed by #6163
Open

Trailing blank line removal in doc comments is not idempotent #6168

overhacked opened this issue May 21, 2024 · 0 comments · May be fixed by #6163
Labels
a-comments bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce

Comments

@overhacked
Copy link

Description

Only one trailing, blank line in a comment is removed each time rustfmt is run, so formatting is not idempotent if multiple trailing, blank lines are present. Blank line removal is enabled by any of the normalize_comments, wrap_comments, or format_code_in_doc_comments (for doc comments only) configuration options. All these features are unstable, so this affects nightly only (as of 2024-05-21 / d5f1200)

This issue is fixed by PR #6163.

Reproduction

Given

rustfmt.toml

wrap_comments = true

code.rs

//! I am a humble module doc comment with many trailing lines
//!
//!

Run

# rustfmt code.rs

Expected

code.rs

//! I am a humble module doc comment with many trailing lines

Actual

code.rs

//! I am a humble module doc comment with many trailing lines
//!
@ytmimi ytmimi added bug Panic, non-idempotency, invalid code, etc. a-comments only-with-option requires a non-default option value to reproduce labels May 29, 2024
@overhacked overhacked linked a pull request Jul 8, 2024 that will close this issue
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. only-with-option requires a non-default option value to reproduce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants