fix: backport fix for #4079
This commit is contained in:
parent
5db7152962
commit
796d6eafa4
@ -529,7 +529,6 @@ impl<'a> CommentRewrite<'a> {
|
||||
.checked_sub(closer.len() + opener.len())
|
||||
.unwrap_or(1);
|
||||
let indent_str = shape.indent.to_string_with_newline(config).to_string();
|
||||
let fmt_indent = shape.indent + (opener.len() - line_start.len());
|
||||
|
||||
let mut cr = CommentRewrite {
|
||||
result: String::with_capacity(orig.len() * 2),
|
||||
@ -540,14 +539,14 @@ impl<'a> CommentRewrite<'a> {
|
||||
comment_line_separator: format!("{}{}", indent_str, line_start),
|
||||
max_width,
|
||||
indent_str,
|
||||
fmt_indent,
|
||||
fmt_indent: shape.indent,
|
||||
|
||||
fmt: StringFormat {
|
||||
opener: "",
|
||||
closer: "",
|
||||
line_start,
|
||||
line_end: "",
|
||||
shape: Shape::legacy(max_width, fmt_indent),
|
||||
shape: Shape::legacy(max_width, shape.indent),
|
||||
trim_end: true,
|
||||
config,
|
||||
},
|
||||
|
8
tests/source/issue-4079.rs
Normal file
8
tests/source/issue-4079.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
|
||||
/*!
|
||||
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
|
||||
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat
|
||||
*/
|
||||
|
||||
/*! Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat */
|
11
tests/target/issue-4079.rs
Normal file
11
tests/target/issue-4079.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// rustfmt-wrap_comments: true
|
||||
|
||||
/*!
|
||||
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
|
||||
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
|
||||
* volutpat
|
||||
*/
|
||||
|
||||
/*! Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
|
||||
* ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
|
||||
* volutpat */
|
Loading…
x
Reference in New Issue
Block a user