-
Notifications
You must be signed in to change notification settings - Fork 888
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
Doc comments on use
declarations are limited to 5 characters less than max_width
#5914
Comments
This issue presents similarly to #5890, but I don't know if the cause is similar—I would expect both doc comments to have the same internal shape. |
Thanks for reaching out. #5890 only applies to multi-line block comments so it's unrelated. The issue here is that we're passing the Lines 126 to 141 in da7f678
I can think of two possible approaches to fixes this:
|
linking the tracking issue for |
Is this bug related then? /* 50 characters:
0 1 2 3 4 5
12345678901234567890123456789012345678901234567890
*/
use aaaaaaaaa::{bbbbbbbbb, ccccccccc, ddddddddd}; After /* 50 characters:
0 1 2 3 4 5
12345678901234567890123456789012345678901234567890
*/
use aaaaaaaaa::{
bbbbbbbbb, ccccccccc, ddddddddd,
}; The |
@taylordotfish It's possible, though my guess is that they're not related since your original issue describes doc comments on imports wrapping too early when using I very much appreciate you taking the time to check other edge cases 🙏🏼. Probably best to create a new issue so we can track that separately. |
If
wrap_comments
is true, doc comments onuse
declarations are wrapped to 5 characters less thanmax_width
(orcomment_width
, if it is less thanmax_width
- 5). This makes it impossible to wrap such comments to the same value asmax_width
.Example:
test.rs:
After running
rustfmt --config wrap_comments=true,comment_width=79,max_width=79 test.rs
:The comment on the
use
declaration is wrapped to 74 characters, exactly 5 less than 79. This five-character difference persists across different values ofcomment_width
andmax_width
, except ifcomment_width
is more than 5 characters less thanmax_width
, both doc comments will be limited to that value.The text was updated successfully, but these errors were encountered: