Skip to content

Commit a0eb97b

Browse files
authored
Issue 4079 (#4080)
1 parent 4d22687 commit a0eb97b

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

rustfmt-core/rustfmt-lib/src/comment.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ impl<'a> CommentRewrite<'a> {
528528
.checked_sub(closer.len() + opener.len())
529529
.unwrap_or(1);
530530
let indent_str = shape.indent.to_string_with_newline(config).to_string();
531-
let fmt_indent = shape.indent + (opener.len() - line_start.len());
532531

533532
let mut cr = CommentRewrite {
534533
result: String::with_capacity(orig.len() * 2),
@@ -539,14 +538,14 @@ impl<'a> CommentRewrite<'a> {
539538
comment_line_separator: format!("{}{}", indent_str, line_start),
540539
max_width,
541540
indent_str,
542-
fmt_indent,
541+
fmt_indent: shape.indent,
543542

544543
fmt: StringFormat {
545544
opener: "",
546545
closer: "",
547546
line_start,
548547
line_end: "",
549-
shape: Shape::legacy(max_width, fmt_indent),
548+
shape: Shape::legacy(max_width, shape.indent),
550549
trim_end: true,
551550
config,
552551
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// rustfmt-wrap_comments: true
2+
3+
/*!
4+
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
5+
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat
6+
*/
7+
8+
/*! Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// rustfmt-wrap_comments: true
2+
3+
/*!
4+
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
5+
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
6+
* volutpat
7+
*/
8+
9+
/*! Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
10+
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
11+
* volutpat */

0 commit comments

Comments
 (0)