Skip to content

Commit be0484b

Browse files
Clean up document_item_info calls
1 parent caf6c57 commit be0484b

File tree

1 file changed

+20
-7
lines changed
  • src/librustdoc/html/render

1 file changed

+20
-7
lines changed

Diff for: src/librustdoc/html/render/mod.rs

+20-7
Original file line numberDiff line numberDiff line change
@@ -1880,10 +1880,17 @@ fn render_markdown(
18801880
fn document_short(
18811881
w: &mut Buffer,
18821882
item: &clean::Item,
1883+
cx: &Context,
18831884
link: AssocItemLink<'_>,
18841885
prefix: &str,
18851886
is_hidden: bool,
1887+
parent: Option<&clean::Item>,
1888+
show_def_docs: bool,
18861889
) {
1890+
document_item_info(w, cx, item, is_hidden, parent);
1891+
if !show_def_docs {
1892+
return;
1893+
}
18871894
if let Some(s) = item.doc_value() {
18881895
let mut summary_html = MarkdownSummaryLine(s, &item.links()).into_string();
18891896

@@ -3806,13 +3813,22 @@ fn render_impl(
38063813
if let Some(it) = t.items.iter().find(|i| i.name == item.name) {
38073814
// We need the stability of the item from the trait
38083815
// because impls can't have a stability.
3809-
document_item_info(w, cx, it, is_hidden, Some(parent));
38103816
if item.doc_value().is_some() {
3817+
document_item_info(w, cx, it, is_hidden, Some(parent));
38113818
document_full(w, item, cx, "", is_hidden);
3812-
} else if show_def_docs {
3819+
} else {
38133820
// In case the item isn't documented,
38143821
// provide short documentation from the trait.
3815-
document_short(w, it, link, "", is_hidden);
3822+
document_short(
3823+
w,
3824+
it,
3825+
cx,
3826+
link,
3827+
"",
3828+
is_hidden,
3829+
Some(parent),
3830+
show_def_docs,
3831+
);
38163832
}
38173833
}
38183834
} else {
@@ -3822,10 +3838,7 @@ fn render_impl(
38223838
}
38233839
}
38243840
} else {
3825-
document_item_info(w, cx, item, is_hidden, Some(parent));
3826-
if show_def_docs {
3827-
document_short(w, item, link, "", is_hidden);
3828-
}
3841+
document_short(w, item, cx, link, "", is_hidden, Some(parent), show_def_docs);
38293842
}
38303843
}
38313844
}

0 commit comments

Comments
 (0)