Skip to content

Commit 8ed935e

Browse files
committed
Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednet
Update pulldown-cmark version to 0.9 Fixes #92206. r? `@camelid`
2 parents e670844 + 4e2024c commit 8ed935e

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

Cargo.lock

+14-3
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ dependencies = [
619619
"clippy_utils",
620620
"if_chain",
621621
"itertools 0.10.1",
622-
"pulldown-cmark",
622+
"pulldown-cmark 0.9.0",
623623
"quine-mc_cluskey",
624624
"regex-syntax",
625625
"rustc-semver",
@@ -2154,7 +2154,7 @@ dependencies = [
21542154
"log",
21552155
"memchr",
21562156
"opener",
2157-
"pulldown-cmark",
2157+
"pulldown-cmark 0.8.0",
21582158
"regex",
21592159
"serde",
21602160
"serde_derive",
@@ -2813,6 +2813,17 @@ dependencies = [
28132813
"unicase",
28142814
]
28152815

2816+
[[package]]
2817+
name = "pulldown-cmark"
2818+
version = "0.9.0"
2819+
source = "registry+https://github.com/rust-lang/crates.io-index"
2820+
checksum = "acd16514d1af5f7a71f909a44ef253cdb712a376d7ebc8ae4a471a9be9743548"
2821+
dependencies = [
2822+
"bitflags",
2823+
"memchr",
2824+
"unicase",
2825+
]
2826+
28162827
[[package]]
28172828
name = "punycode"
28182829
version = "0.4.1"
@@ -4615,7 +4626,7 @@ dependencies = [
46154626
"expect-test",
46164627
"itertools 0.9.0",
46174628
"minifier",
4618-
"pulldown-cmark",
4629+
"pulldown-cmark 0.9.0",
46194630
"rayon",
46204631
"regex",
46214632
"rustdoc-json-types",

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ path = "lib.rs"
88

99
[dependencies]
1010
arrayvec = { version = "0.7", default-features = false }
11-
pulldown-cmark = { version = "0.8", default-features = false }
11+
pulldown-cmark = { version = "0.9", default-features = false }
1212
minifier = "0.0.41"
1313
rayon = "1.3.1"
1414
serde = { version = "1.0", features = ["derive"] }

src/librustdoc/html/markdown.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
538538
}
539539

540540
let event = self.inner.next();
541-
if let Some((Event::Start(Tag::Heading(level)), _)) = event {
541+
if let Some((Event::Start(Tag::Heading(level, _, _)), _)) = event {
542542
let mut id = String::new();
543543
for event in &mut self.inner {
544544
match &event.0 {
@@ -560,7 +560,8 @@ impl<'a, 'b, 'ids, I: Iterator<Item = SpannedEvent<'a>>> Iterator
560560
self.buf.push_front((Event::Html(format!("{} ", sec).into()), 0..0));
561561
}
562562

563-
let level = std::cmp::min(level + (self.heading_offset as u32), MAX_HEADER_LEVEL);
563+
let level =
564+
std::cmp::min(level as u32 + (self.heading_offset as u32), MAX_HEADER_LEVEL);
564565
self.buf.push_back((Event::Html(format!("</a></h{}>", level).into()), 0..0));
565566

566567
let start_tags = format!(
@@ -773,7 +774,7 @@ crate fn find_testable_code<T: doctest::Tester>(
773774
tests.add_test(text, block_info, line);
774775
prev_offset = offset.start;
775776
}
776-
Event::Start(Tag::Heading(level)) => {
777+
Event::Start(Tag::Heading(level, _, _)) => {
777778
register_header = Some(level as u32);
778779
}
779780
Event::Text(ref s) if register_header.is_some() => {
@@ -1053,7 +1054,7 @@ impl Markdown<'_> {
10531054
let mut replacer = |broken_link: BrokenLink<'_>| {
10541055
links
10551056
.iter()
1056-
.find(|link| &*link.original_text == broken_link.reference)
1057+
.find(|link| link.original_text.as_str() == &*broken_link.reference)
10571058
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
10581059
};
10591060

@@ -1134,7 +1135,7 @@ impl MarkdownSummaryLine<'_> {
11341135
let mut replacer = |broken_link: BrokenLink<'_>| {
11351136
links
11361137
.iter()
1137-
.find(|link| &*link.original_text == broken_link.reference)
1138+
.find(|link| link.original_text.as_str() == &*broken_link.reference)
11381139
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
11391140
};
11401141

@@ -1168,7 +1169,7 @@ fn markdown_summary_with_limit(
11681169
let mut replacer = |broken_link: BrokenLink<'_>| {
11691170
link_names
11701171
.iter()
1171-
.find(|link| &*link.original_text == broken_link.reference)
1172+
.find(|link| link.original_text.as_str() == &*broken_link.reference)
11721173
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
11731174
};
11741175

@@ -1311,10 +1312,10 @@ crate fn markdown_links(md: &str) -> Vec<MarkdownLink> {
13111312
};
13121313

13131314
let mut push = |link: BrokenLink<'_>| {
1314-
let span = span_for_link(&CowStr::Borrowed(link.reference), link.span);
1315+
let span = span_for_link(&link.reference, link.span);
13151316
links.borrow_mut().push(MarkdownLink {
13161317
kind: LinkType::ShortcutUnknown,
1317-
link: link.reference.to_owned(),
1318+
link: link.reference.to_string(),
13181319
range: span,
13191320
});
13201321
None

src/tools/clippy/clippy_lints/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cargo_metadata = "0.14"
1313
clippy_utils = { path = "../clippy_utils" }
1414
if_chain = "1.0"
1515
itertools = "0.10"
16-
pulldown-cmark = { version = "0.8", default-features = false }
16+
pulldown-cmark = { version = "0.9", default-features = false }
1717
quine-mc_cluskey = "0.2"
1818
regex-syntax = "0.6"
1919
serde = { version = "1.0", features = ["derive"] }

src/tools/clippy/clippy_lints/src/doc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -542,16 +542,16 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
542542
},
543543
Start(Link(_, url, _)) => in_link = Some(url),
544544
End(Link(..)) => in_link = None,
545-
Start(Heading(_) | Paragraph | Item) => {
546-
if let Start(Heading(_)) = event {
545+
Start(Heading(_, _, _) | Paragraph | Item) => {
546+
if let Start(Heading(_, _, _)) = event {
547547
in_heading = true;
548548
}
549549
ticks_unbalanced = false;
550550
let (_, span) = get_current_span(spans, range.start);
551551
paragraph_span = first_line_of_span(cx, span);
552552
},
553-
End(Heading(_) | Paragraph | Item) => {
554-
if let End(Heading(_)) = event {
553+
End(Heading(_, _, _) | Paragraph | Item) => {
554+
if let End(Heading(_, _, _)) = event {
555555
in_heading = false;
556556
}
557557
if ticks_unbalanced {

0 commit comments

Comments
 (0)