Simplify loop and remove old debugging code
Co-authored-by: Joshua Nelson <jyn514@gmail.com>
This commit is contained in:
parent
4b1b277cf9
commit
eaf851288e
@ -636,21 +636,12 @@ fn print_const_with_custom_print_scalar(cx: &DocContext<'_>, ct: &'tcx ty::Const
|
||||
let mut current = def_id;
|
||||
// The immediate parent might not always be a module.
|
||||
// Find the first parent which is.
|
||||
loop {
|
||||
if let Some(parent) = tcx.parent(current) {
|
||||
if tcx.def_kind(parent) == DefKind::Mod {
|
||||
break Some(parent);
|
||||
}
|
||||
current = parent;
|
||||
} else {
|
||||
debug!(
|
||||
"{:?} has no parent (kind={:?}, original was {:?})",
|
||||
current,
|
||||
tcx.def_kind(current),
|
||||
def_id
|
||||
);
|
||||
break None;
|
||||
while let Some(parent) = tcx.parent(current) {
|
||||
if tcx.def_kind(parent) == DefKind::Mod {
|
||||
return Some(parent);
|
||||
}
|
||||
current = parent;
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user