diff options
| author | Dániel Buga <bugadani@gmail.com> | 2020-10-18 10:59:03 +0200 |
|---|---|---|
| committer | Dániel Buga <bugadani@gmail.com> | 2020-10-18 11:01:09 +0200 |
| commit | 2e9943990014013dbe2e1878d3f11f331a50c115 (patch) | |
| tree | 3d52a66a2a11b83c72d5ef6484f725ec7c5ba10a | |
| parent | f3a0f68453ee695495d88db2d3de3aadedaac3d9 (diff) | |
| download | rust-2e9943990014013dbe2e1878d3f11f331a50c115.tar.gz rust-2e9943990014013dbe2e1878d3f11f331a50c115.zip | |
Replace unnecessary map_or_else with map_or
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/hir/place.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index abd899e8db4..752e57e4b6f 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -968,7 +968,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: & while let Some(attr) = attrs.next() { if attr.is_doc_comment() { sugared_span = - Some(sugared_span.map_or_else(|| attr.span, |span| span.with_hi(attr.span.hi()))); + Some(sugared_span.map_or(attr.span, |span| span.with_hi(attr.span.hi()))); } if attrs.peek().map(|next_attr| next_attr.is_doc_comment()).unwrap_or_default() { diff --git a/compiler/rustc_middle/src/hir/place.rs b/compiler/rustc_middle/src/hir/place.rs index bcb56fae170..5da4be4e982 100644 --- a/compiler/rustc_middle/src/hir/place.rs +++ b/compiler/rustc_middle/src/hir/place.rs @@ -103,7 +103,7 @@ impl<'tcx> Place<'tcx> { /// Returns the type of this `Place` after all projections have been applied. pub fn ty(&self) -> Ty<'tcx> { - self.projections.last().map_or_else(|| self.base_ty, |proj| proj.ty) + self.projections.last().map_or(self.base_ty, |proj| proj.ty) } /// Returns the type of this `Place` immediately before `projection_index`th projection |
