File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -362,12 +362,18 @@ fn identify_comment(
362
362
} ;
363
363
364
364
let ( first_group, rest) = orig. split_at ( first_group_ending) ;
365
+
366
+ let is_doc_comment_with_our_determination = is_doc_comment || style. is_doc_comment ( ) ;
365
367
let rewritten_first_group =
366
368
if !config. normalize_comments ( ) && has_bare_lines && style. is_block_comment ( ) {
367
369
trim_left_preserve_layout ( first_group, shape. indent , config) ?
368
370
} else if !config. normalize_comments ( )
369
371
&& !config. wrap_comments ( )
370
- && !config. format_code_in_doc_comments ( )
372
+ && !(
373
+ // `format_code_in_doc_comments` should only take effect on doc comments,
374
+ // so we only consider it when this comment block is a doc comment block.
375
+ is_doc_comment_with_our_determination && config. format_code_in_doc_comments ( )
376
+ )
371
377
{
372
378
light_rewrite_comment ( first_group, shape. indent , config, is_doc_comment)
373
379
} else {
@@ -377,7 +383,7 @@ fn identify_comment(
377
383
style,
378
384
shape,
379
385
config,
380
- is_doc_comment || style . is_doc_comment ( ) ,
386
+ is_doc_comment_with_our_determination ,
381
387
) ?
382
388
} ;
383
389
if rest. is_empty ( ) {
You can’t perform that action at this time.
0 commit comments