From f97b3f08cde6dff89c8c236fce2479725d7f909e Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Fri, 24 Mar 2017 06:18:23 +0300 Subject: [PATCH] Unnecessary iteration in BTreeMap::drop `IntoIter::drop` already iterates. --- src/libcollections/btree/map.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index bed216ba3d1..dcacef4f0f0 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -141,8 +141,7 @@ pub struct BTreeMap { unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap { fn drop(&mut self) { unsafe { - for _ in ptr::read(self).into_iter() { - } + drop(ptr::read(self).into_iter()); } } }