about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/elaborate_drops.rs')
-rw-r--r--compiler/rustc_mir_dataflow/src/elaborate_drops.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
index 1d7d905c937..9e02b027182 100644
--- a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
+++ b/compiler/rustc_mir_dataflow/src/elaborate_drops.rs
@@ -860,20 +860,14 @@ where
     fn open_drop(&mut self) -> BasicBlock {
         let ty = self.place_ty(self.place);
         match ty.kind() {
-            ty::Closure(_, args) => {
-                let tys: Vec<_> = args.as_closure().upvar_tys().collect();
-                self.open_drop_for_tuple(&tys)
-            }
+            ty::Closure(_, args) => self.open_drop_for_tuple(&args.as_closure().upvar_tys()),
             // Note that `elaborate_drops` only drops the upvars of a generator,
             // and this is ok because `open_drop` here can only be reached
             // within that own generator's resume function.
             // This should only happen for the self argument on the resume function.
             // It effectively only contains upvars until the generator transformation runs.
             // See librustc_body/transform/generator.rs for more details.
-            ty::Generator(_, args, _) => {
-                let tys: Vec<_> = args.as_generator().upvar_tys().collect();
-                self.open_drop_for_tuple(&tys)
-            }
+            ty::Generator(_, args, _) => self.open_drop_for_tuple(&args.as_generator().upvar_tys()),
             ty::Tuple(fields) => self.open_drop_for_tuple(fields),
             ty::Adt(def, args) => self.open_drop_for_adt(*def, args),
             ty::Dynamic(..) => self.complete_drop(self.succ, self.unwind),