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 wraps (long) headers #5238

Closed
virtualritz opened this issue Feb 25, 2022 · 4 comments · Fixed by #5242
Closed

wrap_comments wraps (long) headers #5238

virtualritz opened this issue Feb 25, 2022 · 4 comments · Fixed by #5242
Assignees
Labels
a-comments only-with-option requires a non-default option value to reproduce

Comments

@virtualritz
Copy link

virtualritz commented Feb 25, 2022

Input (from the miette crate's docs):

/// # Wrapping Types That Do Not Implement `Error` (e.g. `&str` and `Box<dyn Error>`)

After cargo fmt with rustfmt.toml:

edition = "2021"
wrap_comments = true
format_code_in_doc_comments = true

Output:

/// # Wrapping Types That Do Not Implement `Error` (e.g. `&str` and `Box<dyn
/// Error>`)

Which renders as:
Screen Shot 2022-02-25 at 15 57 09

Fix

Do not ever break comment lines starting with # even when wrap_comments is set.

@ytmimi ytmimi added a-comments only-with-option requires a non-default option value to reproduce labels Feb 25, 2022
@ytmimi
Copy link
Contributor

ytmimi commented Feb 25, 2022

Thanks for submitting this report!

I think the proposed fix makes sense, and I should have a fix for this soon!

@ytmimi
Copy link
Contributor

ytmimi commented Feb 25, 2022

@rustbot claim

@ytmimi
Copy link
Contributor

ytmimi commented Feb 25, 2022

Looking into this a little more I think only the wrap_comments = true configuration option is causing the issue. Appreciate you listing all the options you're using though!

@virtualritz
Copy link
Author

virtualritz commented Feb 25, 2022

Yes, I assumed this (see title of this issue) but since I didn't have time to test this assumption I thought I dump the entire rustfmt.toml in use in miette. 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-comments 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