diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-12-26 14:03:33 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-01-02 19:16:27 +0100 |
| commit | 4ba1928fa2aa73abeb541dad7d72bda94509d113 (patch) | |
| tree | c7b58d8fcacc6e4bcfba45cab0b4e1704a63869c /src/librustdoc/html | |
| parent | 0ab6c90699e5fc70ee0a9bfe369bc356f05127f9 (diff) | |
| download | rust-4ba1928fa2aa73abeb541dad7d72bda94509d113.tar.gz rust-4ba1928fa2aa73abeb541dad7d72bda94509d113.zip | |
Improve code for DocFragment rework
Diffstat (limited to 'src/librustdoc/html')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 8 |
1 files changed, 2 insertions, 6 deletions
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<String> { - 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, "<tr class=\"{stab}{add}module-item\">\ |
