diff --git a/src/utils/html.rs b/src/utils/html.rs index a7fe2b41a..4c797d2c8 100644 --- a/src/utils/html.rs +++ b/src/utils/html.rs @@ -49,6 +49,27 @@ fn extract_from_rcdom(dom: &RcDom) -> Result<(Handle, Handle)> { let head = head.ok_or_else(|| err_msg("couldn't find
tag in rustdoc output"))?; let body = body.ok_or_else(|| err_msg("couldn't find tag in rustdoc output"))?; + + { + head.children.borrow_mut().retain(|node| { + match node.data { + NodeData::Element { ref name, ref attrs, .. } => { + // `` is rustdoc's custom favicon, but we want to + // use our own, so ditch it so browsers request the favicon at the domain root + // instead + !(name.local == *"link" && + attrs.borrow() + .iter() + .any(|attr| { + attr.name.local == *"rel" && + &*attr.value == "shortcut icon" + })) + } + _ => true, + } + }); + } + Ok((head, body)) }