File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -823,7 +823,8 @@ fn rewrite_comment_inner(
823
823
const RUSTFMT_CUSTOM_COMMENT_PREFIX : & str = "//#### " ;
824
824
825
825
fn hide_sharp_behind_comment ( s : & str ) -> Cow < ' _ , str > {
826
- if s. trim_start ( ) . starts_with ( "# " ) {
826
+ let s_trimmed = s. trim ( ) ;
827
+ if s_trimmed. starts_with ( "# " ) || s_trimmed == "#" {
827
828
Cow :: from ( format ! ( "{}{}" , RUSTFMT_CUSTOM_COMMENT_PREFIX , s) )
828
829
} else {
829
830
Cow :: from ( s)
Original file line number Diff line number Diff line change
1
+ // rustfmt-format_code_in_doc_comments: true
2
+
3
+ //! Empty pound line
4
+ //!
5
+ //! ```rust
6
+ //! #
7
+ //! # fn main() {
8
+ //! foo ( ) ;
9
+ //! # }
10
+ //! ```
Original file line number Diff line number Diff line change
1
+ // rustfmt-format_code_in_doc_comments: true
2
+
3
+ //! Empty pound line
4
+ //!
5
+ //! ```rust
6
+ //! #
7
+ //! # fn main() {
8
+ //! foo();
9
+ //! # }
10
+ //! ```
You can’t perform that action at this time.
0 commit comments