This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +3
-23
lines changed Expand file tree Collapse file tree 3 files changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -618,7 +618,7 @@ impl<'a> CommentRewrite<'a> {
618
618
_ if self . code_block_buffer . is_empty ( ) => String :: new ( ) ,
619
619
_ => {
620
620
let mut config = self . fmt . config . clone ( ) ;
621
- config. set ( ) . format_doc_comments ( false ) ;
621
+ config. set ( ) . wrap_comments ( false ) ;
622
622
match :: format_code_block ( & self . code_block_buffer , & config) {
623
623
Some ( ref s) => trim_custom_comment_prefix ( & s. snippet ) ,
624
624
None => trim_custom_comment_prefix ( & self . code_block_buffer ) ,
@@ -790,16 +790,9 @@ fn trim_custom_comment_prefix(s: &str) -> String {
790
790
. map ( |line| {
791
791
let left_trimmed = line. trim_left ( ) ;
792
792
if left_trimmed. starts_with ( RUSTFMT_CUSTOM_COMMENT_PREFIX ) {
793
- let orig = left_trimmed. trim_left_matches ( RUSTFMT_CUSTOM_COMMENT_PREFIX ) ;
794
- // due to comment wrapping, a line that was originally behind `#` is split over
795
- // multiple lines, which needs then to be prefixed with a `#`
796
- if !orig. trim_left ( ) . starts_with ( "# " ) {
797
- Cow :: from ( format ! ( "# {}" , orig) )
798
- } else {
799
- Cow :: from ( orig)
800
- }
793
+ left_trimmed. trim_left_matches ( RUSTFMT_CUSTOM_COMMENT_PREFIX )
801
794
} else {
802
- Cow :: from ( line)
795
+ line
803
796
}
804
797
} )
805
798
. collect :: < Vec < _ > > ( )
File renamed without changes.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments