Don't generate anchors on inherent impl methods

This commit is contained in:
Guillaume Gomez 2022-07-06 13:48:51 +02:00
parent 5b8cf49c51
commit 7d205afae4

View File

@ -1415,7 +1415,10 @@ fn render_impl(
id, item_type, in_trait_class,
);
render_rightside(w, cx, item, containing_item, render_mode);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
}
w.write_str("<h4 class=\"code-header\">");
render_assoc_item(
w,
@ -1438,7 +1441,10 @@ fn render_impl(
id, item_type, in_trait_class
);
render_rightside(w, cx, item, containing_item, render_mode);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
}
w.write_str("<h4 class=\"code-header\">");
assoc_const(
w,
@ -1460,7 +1466,10 @@ fn render_impl(
let source_id = format!("{}.{}", item_type, name);
let id = cx.derive_id(source_id.clone());
write!(w, "<section id=\"{}\" class=\"{}{}\">", id, item_type, in_trait_class);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
}
w.write_str("<h4 class=\"code-header\">");
assoc_type(
w,
@ -1483,7 +1492,10 @@ fn render_impl(
"<section id=\"{}\" class=\"{}{} has-srclink\">",
id, item_type, in_trait_class
);
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
if trait_.is_some() {
// Anchors are only used on trait impls.
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
}
w.write_str("<h4 class=\"code-header\">");
assoc_type(
w,