Skip to content

Commit

Permalink
Replace unnecessary map_or_else with map_or
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 18, 2020
1 parent f3a0f68 commit 2e99439
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/place.rs
Expand Up @@ -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
Expand Down

0 comments on commit 2e99439

Please sign in to comment.