Skip to content

Commit

Permalink
Fix incorrect logic when merging matches
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Dec 20, 2020
1 parent 1e15c2f commit 60d5567
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,13 @@ impl<'a, 'b, 'ids, I: Iterator<Item = (Event<'a>, Range<usize>)>> Iterator
if let Some((Event::Start(Tag::Heading(level)), _)) = event {
let mut id = String::new();
for event in &mut self.inner {
match event.0 {
match &event.0 {
Event::End(Tag::Heading(..)) => break,
Event::Start(Tag::Link(_, _, _)) | Event::End(Tag::Link(..)) => {}
Event::Text(text) | Event::Code(text) => {
id.extend(text.chars().filter_map(slugify));
self.buf.push_back(event);
}
Event::Start(Tag::Link(_, _, _)) | Event::End(Tag::Link(..)) => {}
_ => self.buf.push_back(event),
}
}
Expand Down

0 comments on commit 60d5567

Please sign in to comment.