| CommentStyle::TripleSlash
| CommentStyle::Custom(..)
| CommentStyle::Doc => "",
- CommentStyle::DoubleBullet => " **/",
- CommentStyle::SingleBullet | CommentStyle::Exclamation => " */",
+ CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => {
+ " */"
+ }
}
}
CommentStyle::DoubleSlash => "// ",
CommentStyle::TripleSlash => "/// ",
CommentStyle::Doc => "//! ",
- CommentStyle::SingleBullet | CommentStyle::Exclamation => " * ",
- CommentStyle::DoubleBullet => " ** ",
+ CommentStyle::SingleBullet | CommentStyle::DoubleBullet | CommentStyle::Exclamation => {
+ " * "
+ }
CommentStyle::Custom(opener) => opener,
}
}
.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),
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,
},
// We missed some comments. Warn and keep the original text.
if context.config.error_on_unformatted() {
context.report.append(
- context.source_map.span_to_filename(span).into(),
+ context.parse_sess.span_to_filename(span),
vec![FormattingError::from_span(
span,
- &context.source_map,
+ &context.parse_sess,
ErrorKind::LostComment,
)],
);