Skip to content

Commit

Permalink
Rollup merge of #80794 - LingMan:map_or, r=jyn514
Browse files Browse the repository at this point in the history
Use Option::map_or instead of `.map(..).unwrap_or(..)`

r? `@jyn514`
`@rustbot` modify labels +C-cleanup +T-rustdoc
  • Loading branch information
JohnTitor committed Jan 8, 2021
2 parents 1ed90e4 + 961f9ee commit faf5412
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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(),
},
Expand Down

0 comments on commit faf5412

Please sign in to comment.