Skip to content

Commit afb9737

Browse files
committed
clippy: update to pulldown-cmark 0.11
1 parent 39a3eeb commit afb9737

File tree

1 file changed

+16
-16
lines changed
  • src/tools/clippy/clippy_lints/src/doc

1 file changed

+16
-16
lines changed

Diff for: src/tools/clippy/clippy_lints/src/doc/mod.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use clippy_utils::ty::is_type_diagnostic_item;
66
use clippy_utils::visitors::Visitable;
77
use clippy_utils::{in_constant, is_entrypoint_fn, is_trait_impl_item, method_chain_args};
88
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,
1010
};
1111
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};
1313
use rustc_ast::ast::Attribute;
1414
use rustc_data_structures::fx::FxHashSet;
1515
use rustc_hir::intravisit::{self, Visitor};
@@ -659,7 +659,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
659659

660660
while let Some((event, range)) = events.next() {
661661
match event {
662-
Html(tag) => {
662+
Html(tag) | InlineHtml(tag) => {
663663
if tag.starts_with("<code") {
664664
code_level += 1;
665665
} else if tag.starts_with("</code") {
@@ -670,11 +670,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
670670
blockquote_level -= 1;
671671
}
672672
},
673-
Start(BlockQuote) => {
673+
Start(BlockQuote(_)) => {
674674
blockquote_level += 1;
675675
containers.push(Container::Blockquote);
676676
},
677-
End(BlockQuote) => {
677+
End(TagEnd::BlockQuote) => {
678678
blockquote_level -= 1;
679679
containers.pop();
680680
},
@@ -699,15 +699,15 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
699699
}
700700
}
701701
},
702-
End(CodeBlock(_)) => {
702+
End(TagEnd::CodeBlock) => {
703703
in_code = false;
704704
is_rust = false;
705705
ignore = false;
706706
},
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 {
711711
in_heading = true;
712712
}
713713
if let Start(Item) = event {
@@ -720,11 +720,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
720720
ticks_unbalanced = false;
721721
paragraph_range = range;
722722
},
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 {
725725
in_heading = false;
726726
}
727-
if let End(Item) = event {
727+
if let End(TagEnd::Item) = event {
728728
containers.pop();
729729
}
730730
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
746746
text_to_check = Vec::new();
747747
},
748748
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
751751
SoftBreak | HardBreak => {
752752
if !containers.is_empty()
753753
&& 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
765765
);
766766
}
767767
},
768-
TaskListMarker(_) | Code(_) | Rule => (),
768+
TaskListMarker(_) | Code(_) | Rule | InlineMath(..) | DisplayMath(..) => (),
769769
FootnoteReference(text) | Text(text) => {
770770
paragraph_range.end = range.end;
771771
ticks_unbalanced |= text.contains('`') && !in_code;

0 commit comments

Comments
 (0)