Skip to content

Commit e6c288e

Browse files
pan93412ytmimi
authored andcommitted
fix(comment): Prefer light_rewrite_comment if it is not a doccomment
1 parent ee0b6a7 commit e6c288e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/comment.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ fn identify_comment(
365365
trim_left_preserve_layout(first_group, shape.indent, config)?
366366
} else if !config.normalize_comments()
367367
&& !config.wrap_comments()
368-
&& !config.format_code_in_doc_comments()
368+
&& !(
369+
// `format_code_in_doc_comments` should only take effect on doc comments,
370+
// so we only consider it when this comment block is a doc comment block.
371+
is_doc_comment && config.format_code_in_doc_comments()
372+
)
369373
{
370374
light_rewrite_comment(first_group, shape.indent, config, is_doc_comment)
371375
} else {

0 commit comments

Comments
 (0)