diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 2ae28dcd0c478..015e8885c1b1b 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -418,7 +418,7 @@ impl<'a, I: Iterator- >> Iterator for LinkReplacer<'a, I> {
struct HeadingLinks<'a, 'b, 'ids, I> {
inner: I,
toc: Option<&'b mut TocBuilder>,
- buf: VecDeque<(Event<'a>, Range)>,
+ buf: VecDeque>,
id_map: &'ids mut IdMap,
}
@@ -428,10 +428,8 @@ impl<'a, 'b, 'ids, I> HeadingLinks<'a, 'b, 'ids, I> {
}
}
-impl<'a, 'b, 'ids, I: Iterator
- , Range)>> Iterator
- for HeadingLinks<'a, 'b, 'ids, I>
-{
- type Item = (Event<'a>, Range);
+impl<'a, 'b, 'ids, I: Iterator
- >> Iterator for HeadingLinks<'a, 'b, 'ids, I> {
+ type Item = Event<'a>;
fn next(&mut self) -> Option {
if let Some(e) = self.buf.pop_front() {
@@ -439,29 +437,31 @@ impl<'a, 'b, 'ids, I: Iterator
- , Range)>> Iterator
}
let event = self.inner.next();
- if let Some((Event::Start(Tag::Heading(level)), _)) = event {
+ 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 {
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);
}
- _ => self.buf.push_back(event),
+ _ => {}
+ }
+ match event {
+ Event::Start(Tag::Link(_, _, _)) | Event::End(Tag::Link(..)) => {}
+ event => self.buf.push_back(event),
}
}
let id = self.id_map.derive(id);
if let Some(ref mut builder) = self.toc {
let mut html_header = String::new();
- html::push_html(&mut html_header, self.buf.iter().map(|(ev, _)| ev.clone()));
+ html::push_html(&mut html_header, self.buf.iter().cloned());
let sec = builder.push(level as u32, html_header, id.clone());
- self.buf.push_front((Event::Html(format!("{} ", sec).into()), 0..0));
+ self.buf.push_front(Event::Html(format!("{} ", sec).into()));
}
- self.buf.push_back((Event::Html(format!("", level).into()), 0..0));
+ self.buf.push_back(Event::Html(format!("", level).into()));
let start_tags = format!(
"