about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/traits/vtable.rs49
1 files changed, 24 insertions, 25 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/vtable.rs b/compiler/rustc_trait_selection/src/traits/vtable.rs
index 0a3f423d3c1..ac9fb51e391 100644
--- a/compiler/rustc_trait_selection/src/traits/vtable.rs
+++ b/compiler/rustc_trait_selection/src/traits/vtable.rs
@@ -116,34 +116,33 @@ 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 mut direct_super_traits_iter = tcx
-                    .super_predicates_of(inner_most_trait_ref.def_id())
-                    .predicates
-                    .into_iter()
-                    .filter_map(move |(pred, _)| {
-                        pred.subst_supertrait(tcx, &inner_most_trait_ref).as_trait_clause()
-                    });
+            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
+                .into_iter()
+                .filter_map(move |(pred, _)| {
+                    pred.subst_supertrait(tcx, &inner_most_trait_ref).as_trait_clause()
+                });
 
-                'diving_in_skip_visited_traits: loop {
-                    if let Some(next_super_trait) = direct_super_traits_iter.next() {
-                        if visited.insert(next_super_trait.to_predicate(tcx)) {
-                            // We're throwing away potential constness of super traits here.
-                            // FIXME: handle ~const super traits
-                            let next_super_trait = next_super_trait.map_bound(|t| t.trait_ref);
-                            stack.push((
-                                next_super_trait,
-                                emit_vptr_on_new_entry,
-                                Some(direct_super_traits_iter),
-                            ));
-                            break 'diving_in_skip_visited_traits;
-                        } else {
-                            continue 'diving_in_skip_visited_traits;
-                        }
+            'diving_in_skip_visited_traits: loop {
+                if let Some(next_super_trait) = direct_super_traits_iter.next() {
+                    if visited.insert(next_super_trait.to_predicate(tcx)) {
+                        // We're throwing away potential constness of super traits here.
+                        // FIXME: handle ~const super traits
+                        let next_super_trait = next_super_trait.map_bound(|t| t.trait_ref);
+                        stack.push((
+                            next_super_trait,
+                            emit_vptr_on_new_entry,
+                            Some(direct_super_traits_iter),
+                        ));
+                        break 'diving_in_skip_visited_traits;
                     } else {
-                        break 'diving_in;
+                        continue 'diving_in_skip_visited_traits;
                     }
+                } else {
+                    break 'diving_in;
                 }
             }
         }