File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -572,10 +572,12 @@ where
572
572
let comment_end = match self . inner . peek ( ) {
573
573
Some ( ..) => {
574
574
let mut block_open_index = post_snippet. find ( "/*" ) ;
575
- // check if it really is a block comment (and not //*)
575
+ // check if it really is a block comment (and not ` //*` or a nested comment )
576
576
if let Some ( i) = block_open_index {
577
- if i > 0 && & post_snippet[ i - 1 ..i] == "/" {
578
- block_open_index = None ;
577
+ match post_snippet. find ( "/" ) {
578
+ Some ( j) if j < i => block_open_index = None ,
579
+ _ if i > 0 && & post_snippet[ i - 1 ..i] == "/" => block_open_index = None ,
580
+ _ => ( ) ,
579
581
}
580
582
}
581
583
let newline_index = post_snippet. find ( '\n' ) ;
Original file line number Diff line number Diff line change @@ -81,3 +81,10 @@ fn some_fn4()
81
81
/* some comment some comment some comment some comment some comment some comment some comment */
82
82
{
83
83
}
84
+
85
+ // #1603
86
+ pub enum Foo {
87
+ A , // `/** **/`
88
+ B , // `/*!`
89
+ C ,
90
+ }
Original file line number Diff line number Diff line change @@ -86,3 +86,10 @@ fn some_fn4()
86
86
// some comment
87
87
{
88
88
}
89
+
90
+ // #1603
91
+ pub enum Foo {
92
+ A , // `/** **/`
93
+ B , // `/*!`
94
+ C ,
95
+ }
You can’t perform that action at this time.
0 commit comments