Skip to content

Commit 61d64d5

Browse files
committed
Add description in configurations.md
1 parent efdfd4b commit 61d64d5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Configurations.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,44 @@ fn main() {
27542754
}
27552755
```
27562756

2757+
## `strict_line_comment_wrap`
2758+
2759+
Wrap long line comments (`//`) that exceed the maximum width, even if they are not markdown headers. This option works in combination with `wrap_comments`.
2760+
2761+
- **Default value**: `false`
2762+
- **Possible values**: `true`, `false`
2763+
- **Stable**: No (tracking issue: [#6726](https://github.com/rust-lang/rustfmt/issues/6726))
2764+
2765+
#### `false` (default):
2766+
2767+
Long line comments may remain unwrapped:
2768+
2769+
```rust
2770+
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
2771+
fn foo() {
2772+
println!("Lorem");
2773+
}
2774+
```
2775+
#### `true`:
2776+
2777+
Long line comments are automatically wrapped to fit within the configured maximum width, preserving indentation and // prefixes, without introducing blank lines between segments:
2778+
2779+
```rust
2780+
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
2781+
// tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
2782+
// veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
2783+
// ea commodo consequat.
2784+
fn main() {
2785+
println!("Hello, world!");
2786+
}
2787+
```
2788+
2789+
- Works with `wrap_comments = true`.
2790+
- Inline comments attached to code (`println!("Hello"); // comment`) are also wrapped correctly.
2791+
- Markdown header doc comments (`/// # Header`) are **not wrapped**.
2792+
2793+
See also: [`wrap_comments`](#wrap_comments).
2794+
27572795
## `struct_field_align_threshold`
27582796

27592797
The maximum diff of width between struct fields to be aligned with each other.

0 commit comments

Comments
 (0)