You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*0 1 2 3 4 5 6 7 8 90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789*/// This line has 100 characters ...................................................................9pubstructFoo{// This line has 100 characters ...............................................................9pubfoo:u8,}pubmod foo {// This line has 100 characters ...............................................................9pubfnfoo(){}}
Content of rustfmt.toml:
comment_width = 100wrap_comments = true
Expected formatting is that nothing changes. The file is already correctly formatted.
Actual formatting is the following (the line on the foo field of the Foo struct is wrapped):
/*0 1 2 3 4 5 6 7 8 90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789*/// This line has 100 characters ...................................................................9pubstructFoo{// This line has 100 characters// ...............................................................9pubfoo:u8,}pubmod foo {// This line has 100 characters ...............................................................9pubfnfoo(){}}
This is probably a minimum reproduction example of #4929, indicating that this is an old issue, and probably not a regression but an off-by-one since the introduction of this feature.
Also I observed that comment_width seems to be capped by max_width although this doesn't seem to be documented. Using comment_width = 200 produces the same off-by-one behavior.
The text was updated successfully, but these errors were encountered:
Same behavior with variants and with documentation instead of comments. It works correctly with associated items. So this looks specific to structs, enums, and unions. It doesn't apply to traits.
ia0
added a commit
to ia0/wasefire
that referenced
this issue
Jun 1, 2024
Content of
src/lib.rs
:Content of
rustfmt.toml
:Expected formatting is that nothing changes. The file is already correctly formatted.
Actual formatting is the following (the line on the
foo
field of theFoo
struct is wrapped):This is probably a minimum reproduction example of #4929, indicating that this is an old issue, and probably not a regression but an off-by-one since the introduction of this feature.
Also I observed that
comment_width
seems to be capped bymax_width
although this doesn't seem to be documented. Usingcomment_width = 200
produces the same off-by-one behavior.The text was updated successfully, but these errors were encountered: