about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcollections/vec.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index fac84617943..ddab16493f0 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1322,9 +1322,11 @@ impl<T> Drop for Vec<T> {
         // OK because exactly when this stops being a valid assumption, we
         // don't need unsafe_no_drop_flag shenanigans anymore.
         if self.buf.unsafe_no_drop_flag_needs_drop() {
-            if unsafe { needs_drop::<T>() } {
-                for x in self.iter_mut() {
-                    unsafe { drop_in_place(x); }
+            unsafe {
+                if needs_drop::<T>() {
+                    for x in self.iter_mut() {
+                        drop_in_place(x);
+                    }
                 }
             }
         }