@@ -6,10 +6,10 @@ use clippy_utils::ty::is_type_diagnostic_item;
6
6
use clippy_utils:: visitors:: Visitable ;
7
7
use clippy_utils:: { in_constant, is_entrypoint_fn, is_trait_impl_item, method_chain_args} ;
8
8
use pulldown_cmark:: Event :: {
9
- Code , End , FootnoteReference , HardBreak , Html , Rule , SoftBreak , Start , TaskListMarker , Text ,
9
+ Code , DisplayMath , End , FootnoteReference , HardBreak , Html , InlineHtml , InlineMath , Rule , SoftBreak , Start , TaskListMarker , Text ,
10
10
} ;
11
11
use pulldown_cmark:: Tag :: { BlockQuote , CodeBlock , FootnoteDefinition , Heading , Item , Link , Paragraph } ;
12
- use pulldown_cmark:: { BrokenLink , CodeBlockKind , CowStr , Options } ;
12
+ use pulldown_cmark:: { BrokenLink , CodeBlockKind , CowStr , Options , TagEnd } ;
13
13
use rustc_ast:: ast:: Attribute ;
14
14
use rustc_data_structures:: fx:: FxHashSet ;
15
15
use rustc_hir:: intravisit:: { self , Visitor } ;
@@ -659,7 +659,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
659
659
660
660
while let Some ( ( event, range) ) = events. next ( ) {
661
661
match event {
662
- Html ( tag) => {
662
+ Html ( tag) | InlineHtml ( tag ) => {
663
663
if tag. starts_with ( "<code" ) {
664
664
code_level += 1 ;
665
665
} else if tag. starts_with ( "</code" ) {
@@ -670,11 +670,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
670
670
blockquote_level -= 1 ;
671
671
}
672
672
} ,
673
- Start ( BlockQuote ) => {
673
+ Start ( BlockQuote ( _ ) ) => {
674
674
blockquote_level += 1 ;
675
675
containers. push ( Container :: Blockquote ) ;
676
676
} ,
677
- End ( BlockQuote ) => {
677
+ End ( TagEnd :: BlockQuote ) => {
678
678
blockquote_level -= 1 ;
679
679
containers. pop ( ) ;
680
680
} ,
@@ -699,15 +699,15 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
699
699
}
700
700
}
701
701
} ,
702
- End ( CodeBlock ( _ ) ) => {
702
+ End ( TagEnd :: CodeBlock ) => {
703
703
in_code = false ;
704
704
is_rust = false ;
705
705
ignore = false ;
706
706
} ,
707
- Start ( Link ( _ , url , _ ) ) => in_link = Some ( url ) ,
708
- End ( Link ( .. ) ) => in_link = None ,
709
- Start ( Heading ( _ , _ , _ ) | Paragraph | Item ) => {
710
- if let Start ( Heading ( _ , _ , _ ) ) = event {
707
+ Start ( Link { dest_url , .. } ) => in_link = Some ( dest_url ) ,
708
+ End ( TagEnd :: Link ) => in_link = None ,
709
+ Start ( Heading { .. } | Paragraph | Item ) => {
710
+ if let Start ( Heading { .. } ) = event {
711
711
in_heading = true ;
712
712
}
713
713
if let Start ( Item ) = event {
@@ -720,11 +720,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
720
720
ticks_unbalanced = false ;
721
721
paragraph_range = range;
722
722
} ,
723
- End ( Heading ( _, _ , _ ) | Paragraph | Item ) => {
724
- if let End ( Heading ( _ , _ , _) ) = event {
723
+ End ( TagEnd :: Heading ( _) | TagEnd :: Paragraph | TagEnd :: Item ) => {
724
+ if let End ( TagEnd :: Heading ( _) ) = event {
725
725
in_heading = false ;
726
726
}
727
- if let End ( Item ) = event {
727
+ if let End ( TagEnd :: Item ) = event {
728
728
containers. pop ( ) ;
729
729
}
730
730
if ticks_unbalanced && let Some ( span) = fragments. span ( cx, paragraph_range. clone ( ) ) {
@@ -746,8 +746,8 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
746
746
text_to_check = Vec :: new ( ) ;
747
747
} ,
748
748
Start ( FootnoteDefinition ( ..) ) => in_footnote_definition = true ,
749
- End ( FootnoteDefinition ( .. ) ) => in_footnote_definition = false ,
750
- Start ( _tag ) | End ( _tag ) => ( ) , // We don't care about other tags
749
+ End ( TagEnd :: FootnoteDefinition ) => in_footnote_definition = false ,
750
+ Start ( _ ) | End ( _ ) => ( ) , // We don't care about other tags
751
751
SoftBreak | HardBreak => {
752
752
if !containers. is_empty ( )
753
753
&& let Some ( ( next_event, next_range) ) = events. peek ( )
@@ -765,7 +765,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
765
765
) ;
766
766
}
767
767
} ,
768
- TaskListMarker ( _) | Code ( _) | Rule => ( ) ,
768
+ TaskListMarker ( _) | Code ( _) | Rule | InlineMath ( .. ) | DisplayMath ( .. ) => ( ) ,
769
769
FootnoteReference ( text) | Text ( text) => {
770
770
paragraph_range. end = range. end ;
771
771
ticks_unbalanced |= text. contains ( '`' ) && !in_code;
0 commit comments