File tree Expand file tree Collapse file tree 3 files changed +99
-1
lines changed Expand file tree Collapse file tree 3 files changed +99
-1
lines changed Original file line number Diff line number Diff line change @@ -726,7 +726,7 @@ impl<'a> CommentRewrite<'a> {
726726 let code_block = match self . code_block_attr . as_ref ( ) . unwrap ( ) {
727727 CodeBlockAttribute :: Rust
728728 if self . fmt . config . format_code_in_doc_comments ( )
729- && !self . code_block_buffer . is_empty ( ) =>
729+ && !self . code_block_buffer . trim ( ) . is_empty ( ) =>
730730 {
731731 let mut config = self . fmt . config . clone ( ) ;
732732 config. set ( ) . wrap_comments ( false ) ;
Original file line number Diff line number Diff line change 1+ // rustfmt-format_code_in_doc_comments: true
2+
3+ /// ```
4+ /// ```
5+ fn foo ( ) { }
6+
7+ /// ```
8+ ///Something
9+ /// ```
10+ fn foo ( ) { }
11+
12+ /// ```
13+ ///
14+ /// ```
15+ fn foo ( ) { }
16+
17+
18+ /// /// ```
19+ fn foo ( ) { }
20+
21+ /// /// ```
22+ /// ```
23+ ///
24+ /// ```
25+ /// ```
26+ fn foo ( ) { }
27+
28+ fn foo ( ) {
29+ /// ```
30+ ///
31+ /// ```
32+ struct bar { }
33+ }
34+
35+ /// ```
36+ /// fn com(){
37+ /// let i = 5;
38+ ///
39+ /// let j = 6;
40+ /// }
41+ /// ```
42+ fn foo ( ) { }
43+
44+ fn foo ( ) {
45+ /// ```
46+ ///fn com(){
47+ ///let i = 5;
48+ ///}
49+ /// ```
50+ struct bar { }
51+ }
Original file line number Diff line number Diff line change 1+ // rustfmt-format_code_in_doc_comments: true
2+
3+ /// ```
4+ /// ```
5+ fn foo ( ) { }
6+
7+ /// ```
8+ /// Something
9+ /// ```
10+ fn foo ( ) { }
11+
12+ /// ```
13+ /// ```
14+ fn foo ( ) { }
15+
16+ /// /// ```
17+ fn foo ( ) { }
18+
19+ /// /// ```
20+ /// ```
21+ /// ```
22+ /// ```
23+ fn foo ( ) { }
24+
25+ fn foo ( ) {
26+ /// ```
27+ /// ```
28+ struct bar { }
29+ }
30+
31+ /// ```
32+ /// fn com() {
33+ /// let i = 5;
34+ ///
35+ /// let j = 6;
36+ /// }
37+ /// ```
38+ fn foo ( ) { }
39+
40+ fn foo ( ) {
41+ /// ```
42+ /// fn com() {
43+ /// let i = 5;
44+ /// }
45+ /// ```
46+ struct bar { }
47+ }
You can’t perform that action at this time.
0 commit comments