From 961f9ee6dfd21bfcbe75b68eb38ea86bce1dc1d1 Mon Sep 17 00:00:00 2001 From: LingMan Date: Thu, 7 Jan 2021 20:03:59 +0100 Subject: [PATCH] Use Option::map_or instead of `.map(..).unwrap_or(..)` --- src/librustdoc/clean/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0b979120ff9..93991870338 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -942,7 +942,7 @@ fn clean(&self, cx: &DocContext<'_>) -> Arguments { .iter() .enumerate() .map(|(i, ty)| { - let mut name = self.1.get(i).map(|ident| ident.name).unwrap_or(kw::Empty); + let mut name = self.1.get(i).map_or(kw::Empty, |ident| ident.name); if name.is_empty() { name = kw::Underscore; } @@ -1001,7 +1001,7 @@ fn clean(&self, cx: &DocContext<'_>) -> FnDecl { .iter() .map(|t| Argument { type_: t.clean(cx), - name: names.next().map(|i| i.name).unwrap_or(kw::Empty), + name: names.next().map_or(kw::Empty, |i| i.name), }) .collect(), },