Skip to content

Commit 2e99439

Browse files
committed
Replace unnecessary map_or_else with map_or
1 parent f3a0f68 commit 2e99439

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
968968
while let Some(attr) = attrs.next() {
969969
if attr.is_doc_comment() {
970970
sugared_span =
971-
Some(sugared_span.map_or_else(|| attr.span, |span| span.with_hi(attr.span.hi())));
971+
Some(sugared_span.map_or(attr.span, |span| span.with_hi(attr.span.hi())));
972972
}
973973

974974
if attrs.peek().map(|next_attr| next_attr.is_doc_comment()).unwrap_or_default() {

compiler/rustc_middle/src/hir/place.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl<'tcx> Place<'tcx> {
103103

104104
/// Returns the type of this `Place` after all projections have been applied.
105105
pub fn ty(&self) -> Ty<'tcx> {
106-
self.projections.last().map_or_else(|| self.base_ty, |proj| proj.ty)
106+
self.projections.last().map_or(self.base_ty, |proj| proj.ty)
107107
}
108108

109109
/// Returns the type of this `Place` immediately before `projection_index`th projection

0 commit comments

Comments
 (0)