@@ -842,9 +842,9 @@ where
842842 let mut values = Vec :: with_capacity ( adt. variants ( ) . len ( ) ) ;
843843 let mut normal_blocks = Vec :: with_capacity ( adt. variants ( ) . len ( ) ) ;
844844 let mut unwind_blocks =
845- if unwind. is_cleanup ( ) { None } else { Some ( Vec :: with_capacity ( adt. variants ( ) . len ( ) ) ) } ;
845+ Vec :: with_capacity ( if unwind. is_cleanup ( ) { 0 } else { adt. variants ( ) . len ( ) } ) ;
846846 let mut dropline_blocks =
847- if dropline. is_none ( ) { None } else { Some ( Vec :: with_capacity ( adt. variants ( ) . len ( ) ) ) } ;
847+ Vec :: with_capacity ( if dropline. is_none ( ) { 0 } else { adt. variants ( ) . len ( ) } ) ;
848848
849849 let mut have_otherwise_with_drop_glue = false ;
850850 let mut have_otherwise = false ;
@@ -880,7 +880,6 @@ where
880880 // I want to minimize the divergence between MSVC
881881 // and non-MSVC.
882882
883- let unwind_blocks = unwind_blocks. as_mut ( ) . unwrap ( ) ;
884883 let unwind_ladder = vec ! [ Unwind :: InCleanup ; fields. len( ) + 1 ] ;
885884 let dropline_ladder: Vec < Option < BasicBlock > > = vec ! [ None ; fields. len( ) + 1 ] ;
886885 let halfladder =
@@ -890,7 +889,7 @@ where
890889 let ( normal, _, drop_bb) = self . drop_ladder ( fields, succ, unwind, dropline) ;
891890 normal_blocks. push ( normal) ;
892891 if dropline. is_some ( ) {
893- dropline_blocks. as_mut ( ) . unwrap ( ) . push ( drop_bb. unwrap ( ) ) ;
892+ dropline_blocks. push ( drop_bb. unwrap ( ) ) ;
894893 }
895894 } else {
896895 have_otherwise = true ;
@@ -911,28 +910,22 @@ where
911910 } else if !have_otherwise_with_drop_glue {
912911 normal_blocks. push ( self . goto_block ( succ, unwind) ) ;
913912 if let Unwind :: To ( unwind) = unwind {
914- unwind_blocks. as_mut ( ) . unwrap ( ) . push ( self . goto_block ( unwind, Unwind :: InCleanup ) ) ;
913+ unwind_blocks. push ( self . goto_block ( unwind, Unwind :: InCleanup ) ) ;
915914 }
916915 } else {
917916 normal_blocks. push ( self . drop_block ( succ, unwind) ) ;
918917 if let Unwind :: To ( unwind) = unwind {
919- unwind_blocks. as_mut ( ) . unwrap ( ) . push ( self . drop_block ( unwind, Unwind :: InCleanup ) ) ;
918+ unwind_blocks. push ( self . drop_block ( unwind, Unwind :: InCleanup ) ) ;
920919 }
921920 }
922921
923922 (
924923 self . adt_switch_block ( adt, normal_blocks, & values, succ, unwind) ,
925924 unwind. map ( |unwind| {
926- self . adt_switch_block (
927- adt,
928- unwind_blocks. unwrap ( ) ,
929- & values,
930- unwind,
931- Unwind :: InCleanup ,
932- )
925+ self . adt_switch_block ( adt, unwind_blocks, & values, unwind, Unwind :: InCleanup )
933926 } ) ,
934927 dropline. map ( |dropline| {
935- self . adt_switch_block ( adt, dropline_blocks. unwrap ( ) , & values, dropline, unwind)
928+ self . adt_switch_block ( adt, dropline_blocks, & values, dropline, unwind)
936929 } ) ,
937930 )
938931 }
0 commit comments