1
Fork 0

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
This commit is contained in:
Yuki Okushi 2021-01-08 11:11:48 +09:00 committed by GitHub
commit faf5412cd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(),
},