- let body_id = hir_id.map_or(hir::CRATE_HIR_ID, |id| {
- tcx.hir().maybe_body_owned_by(id).map_or(id, |body| body.hir_id)
- });
+ let body_id =
+ local_did.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id));
+ let body_id = match body_id {
+ Some(id) => id,
+ None if hir_id.is_some() => hir_id.unwrap(),
+ _ => hir::CRATE_HIR_ID,
+ };
+