From 4ba1928fa2aa73abeb541dad7d72bda94509d113 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 26 Dec 2020 14:03:33 +0100 Subject: Improve code for DocFragment rework --- src/librustdoc/html/render/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/librustdoc/html') diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 4339fa077e5..1c713df9276 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -198,11 +198,7 @@ impl SharedContext<'_> { /// Based on whether the `collapse-docs` pass was run, return either the `doc_value` or the /// `collapsed_doc_value` of the given item. crate fn maybe_collapsed_doc_value<'a>(&self, item: &'a clean::Item) -> Option { - if self.collapsed { - item.collapsed_doc_value().map(|s| s.to_string()) - } else { - item.doc_value().map(|s| s.to_string()) - } + if self.collapsed { item.collapsed_doc_value() } else { item.doc_value() } } } @@ -2196,7 +2192,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl let stab = myitem.stability_class(cx.tcx()); let add = if stab.is_some() { " " } else { "" }; - let doc_value = myitem.doc_value().unwrap_or_else(String::new); + let doc_value = myitem.doc_value().unwrap_or_default(); write!( w, "\ -- cgit 1.4.1-3-g733a5