Replace if let with unwrap in prepare_vtable_segments
Reasoning: if the stack is empty, the loop will be infinite, so the assumption is that the stack can't be non empty. Unwrap makes the assumption more clear (and removes an indentation level)
This commit is contained in:
@@ -116,8 +116,8 @@ fn prepare_vtable_segments_inner<'tcx, T>(
|
||||
loop {
|
||||
// dive deeper into the stack, recording the path
|
||||
'diving_in: loop {
|
||||
if let Some((inner_most_trait_ref, _, _)) = stack.last() {
|
||||
let inner_most_trait_ref = *inner_most_trait_ref;
|
||||
let &(inner_most_trait_ref, _, _) = stack.last().unwrap();
|
||||
|
||||
let mut direct_super_traits_iter = tcx
|
||||
.super_predicates_of(inner_most_trait_ref.def_id())
|
||||
.predicates
|
||||
@@ -146,7 +146,6 @@ fn prepare_vtable_segments_inner<'tcx, T>(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Other than the left-most path, vptr should be emitted for each trait.
|
||||
emit_vptr_on_new_entry = true;
|
||||
|
||||
Reference in New Issue
Block a user