From 261ca04c925e1844bbd3525168d129055637e60e Mon Sep 17 00:00:00 2001 From: Nicholas-Baron Date: Fri, 6 Nov 2020 13:24:55 -0800 Subject: Changed unwrap_or to unwrap_or_else in some places. The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation. --- src/librustdoc/html/render/cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/librustdoc/html/render') diff --git a/src/librustdoc/html/render/cache.rs b/src/librustdoc/html/render/cache.rs index cf785d362cd..add28de17ed 100644 --- a/src/librustdoc/html/render/cache.rs +++ b/src/librustdoc/html/render/cache.rs @@ -128,7 +128,7 @@ pub fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String { .module .as_ref() .map(|module| shorten(plain_text_summary(module.doc_value()))) - .unwrap_or(String::new()); + .unwrap_or_default(); #[derive(Serialize)] struct CrateData<'a> { -- cgit 1.4.1-3-g733a5