diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-24 17:36:16 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-11-24 21:31:27 +0100 |
| commit | be0484b65def1c07aa2fbc456db0d02f59895b4a (patch) | |
| tree | 30a1a7675852540116817d9074bc4349f8312ba2 /src | |
| parent | caf6c5790a858893c1d32ed2054c9577d12e7493 (diff) | |
| download | rust-be0484b65def1c07aa2fbc456db0d02f59895b4a.tar.gz rust-be0484b65def1c07aa2fbc456db0d02f59895b4a.zip | |
Clean up document_item_info calls
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index bd555f937aa..bbd4be88e6a 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1880,10 +1880,17 @@ fn render_markdown( fn document_short( w: &mut Buffer, item: &clean::Item, + cx: &Context, link: AssocItemLink<'_>, prefix: &str, is_hidden: bool, + parent: Option<&clean::Item>, + show_def_docs: bool, ) { + document_item_info(w, cx, item, is_hidden, parent); + if !show_def_docs { + return; + } if let Some(s) = item.doc_value() { let mut summary_html = MarkdownSummaryLine(s, &item.links()).into_string(); @@ -3806,13 +3813,22 @@ fn render_impl( if let Some(it) = t.items.iter().find(|i| i.name == item.name) { // We need the stability of the item from the trait // because impls can't have a stability. - document_item_info(w, cx, it, is_hidden, Some(parent)); if item.doc_value().is_some() { + document_item_info(w, cx, it, is_hidden, Some(parent)); document_full(w, item, cx, "", is_hidden); - } else if show_def_docs { + } else { // In case the item isn't documented, // provide short documentation from the trait. - document_short(w, it, link, "", is_hidden); + document_short( + w, + it, + cx, + link, + "", + is_hidden, + Some(parent), + show_def_docs, + ); } } } else { @@ -3822,10 +3838,7 @@ fn render_impl( } } } else { - document_item_info(w, cx, item, is_hidden, Some(parent)); - if show_def_docs { - document_short(w, item, link, "", is_hidden); - } + document_short(w, item, cx, link, "", is_hidden, Some(parent), show_def_docs); } } } |
