Skip to content

Commit

Permalink
Use Option::map_or instead of .map(..).unwrap_or(..)
Browse files Browse the repository at this point in the history
  • Loading branch information
LingMan committed Jan 7, 2021
1 parent b5c496d commit 961f9ee
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 961f9ee

Please sign in to comment.