diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2021-01-08 11:11:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-08 11:11:48 +0900 |
| commit | faf5412cd164e9ebd9a890e18e1e9ebefb42038e (patch) | |
| tree | dcc0228a4f39cf2d9094f8964f4d12b5ec68d519 | |
| parent | 1ed90e4f068b7a34dd95ccd83e3a13ebc6b5864e (diff) | |
| parent | 961f9ee6dfd21bfcbe75b68eb38ea86bce1dc1d1 (diff) | |
| download | rust-faf5412cd164e9ebd9a890e18e1e9ebefb42038e.tar.gz rust-faf5412cd164e9ebd9a890e18e1e9ebefb42038e.zip | |
Rollup merge of #80794 - LingMan:map_or, r=jyn514
Use Option::map_or instead of `.map(..).unwrap_or(..)` r? `@jyn514` `@rustbot` modify labels +C-cleanup +T-rustdoc
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 4 |
1 files 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 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], &'a [Ident]) { .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 @@ impl<'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) { .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(), }, |
