fix: backport fix for #4079

This commit is contained in:
Caleb Cartwright 2020-06-11 23:29:51 -05:00
parent 5db7152962
commit 796d6eafa4
3 changed files with 21 additions and 3 deletions

View File

@ -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,
},

View 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 */

View 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 */