Skip to content

Commit a8b5772

Browse files
committed
Use Option::map() instead of if let
1 parent 7682e87 commit a8b5772

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

compiler/rustc_driver/src/pretty.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -324,16 +324,12 @@ impl<'tcx> pprust_hir::PpAnn for TypedAnnotation<'tcx> {
324324
}
325325
fn post(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
326326
if let pprust_hir::AnnNode::Expr(expr) = node {
327-
let typeck_results =
328-
self.maybe_typeck_results.get().or_else(|| {
329-
if let Some(body_id) = self.tcx.hir().maybe_body_owned_by(
330-
self.tcx.hir().local_def_id_to_hir_id(expr.hir_id.owner),
331-
) {
332-
Some(self.tcx.typeck_body(body_id))
333-
} else {
334-
None
335-
}
336-
});
327+
let typeck_results = self.maybe_typeck_results.get().or_else(|| {
328+
self.tcx
329+
.hir()
330+
.maybe_body_owned_by(self.tcx.hir().local_def_id_to_hir_id(expr.hir_id.owner))
331+
.map(|body_id| self.tcx.typeck_body(body_id))
332+
});
337333

338334
if let Some(typeck_results) = typeck_results {
339335
s.s.space();

0 commit comments

Comments
 (0)