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
When comment_width is set to a larger value than max_width, comment_width is still bound by max_width. Take the following project:
rustfmt.toml
wrap_comments = truecomment_width = 1234
main.rs
/// Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut laborefnmain(){println!("Hello, world!");}
The doc comment is fine according to the comment width, but still wrapped as it is longer than 100 characters:
/// Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt/// ut laborefnmain(){println!("Hello, world!");}
The use case I have for this is that I want to format only the code samples in the comments, but not comments itself. (I'm working on pyo3 which has lots of wide doc comments that are wrapped incorrectly with the default comment_width, but which also have many code samples that should be properly formatted.)
I think if you remove wrap_comments and use the option format_doc_comments, you get what you want: it formats the doc test but leaves the comment alone.
When
comment_width
is set to a larger value thanmax_width
,comment_width
is still bound bymax_width
. Take the following project:rustfmt.toml
main.rs
The doc comment is fine according to the comment width, but still wrapped as it is longer than 100 characters:
The use case I have for this is that I want to format only the code samples in the comments, but not comments itself. (I'm working on pyo3 which has lots of wide doc comments that are wrapped incorrectly with the default
comment_width
, but which also have many code samples that should be properly formatted.)rustfmt -V
:rustfmt 0.99.2-nightly (5c9a2b6 2018-08-07)
The text was updated successfully, but these errors were encountered: