Skip to content

Commit b0ed631

Browse files
committed
Some hir cleanups
1 parent c787de3 commit b0ed631

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+2
-2
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'hir> Map<'hir> {
408408
/// item (possibly associated), a closure, or a `hir::AnonConst`.
409409
pub fn body_owner(self, BodyId { hir_id }: BodyId) -> HirId {
410410
let parent = self.get_parent_node(hir_id);
411-
assert!(self.find(parent).map_or(false, |n| is_body_owner(n, hir_id)));
411+
assert!(self.find(parent).map_or(false, |n| is_body_owner(n, hir_id)), "{hir_id:?}");
412412
parent
413413
}
414414

@@ -419,7 +419,7 @@ impl<'hir> Map<'hir> {
419419
/// Given a `LocalDefId`, returns the `BodyId` associated with it,
420420
/// if the node is a body owner, otherwise returns `None`.
421421
pub fn maybe_body_owned_by(self, id: LocalDefId) -> Option<BodyId> {
422-
self.get_if_local(id.to_def_id()).map(associated_body).flatten()
422+
self.find_by_def_id(id).and_then(associated_body)
423423
}
424424

425425
/// Given a body owner's id, returns the `BodyId` associated with it.

0 commit comments

Comments
 (0)