@@ -422,11 +422,12 @@ impl Cursor<'_> {
422422 debug_assert ! ( self . prev( ) == '/' && self . first( ) == '/' ) ;
423423 self . bump ( ) ;
424424
425- let doc_style = match self . first ( ) {
425+ let doc_style = match self . chars ( ) . as_str ( ) . as_bytes ( ) {
426426 // `//!` is an inner line doc comment.
427- '!' => Some ( DocStyle :: Inner ) ,
427+ [ b '!', .. ] => Some ( DocStyle :: Inner ) ,
428428 // `////` (more than 3 slashes) is not considered a doc comment.
429- '/' if self . second ( ) != '/' => Some ( DocStyle :: Outer ) ,
429+ [ b'/' , b'/' , ..] => None ,
430+ [ b'/' , ..] => Some ( DocStyle :: Outer ) ,
430431 _ => None ,
431432 } ;
432433
@@ -438,12 +439,13 @@ impl Cursor<'_> {
438439 debug_assert ! ( self . prev( ) == '/' && self . first( ) == '*' ) ;
439440 self . bump ( ) ;
440441
441- let doc_style = match self . first ( ) {
442+ let doc_style = match self . chars ( ) . as_str ( ) . as_bytes ( ) {
442443 // `/*!` is an inner block doc comment.
443- '!' => Some ( DocStyle :: Inner ) ,
444+ [ b '!', .. ] => Some ( DocStyle :: Inner ) ,
444445 // `/***` (more than 2 stars) is not considered a doc comment.
445446 // `/**/` is not considered a doc comment.
446- '*' if !matches ! ( self . second( ) , '*' | '/' ) => Some ( DocStyle :: Outer ) ,
447+ [ b'*' , b'*' | b'/' , ..] => None ,
448+ [ b'*' , ..] => Some ( DocStyle :: Outer ) ,
447449 _ => None ,
448450 } ;
449451
@@ -464,7 +466,7 @@ impl Cursor<'_> {
464466 break ;
465467 }
466468 }
467- _ => ( ) ,
469+ _ => { }
468470 }
469471 }
470472
0 commit comments