Replace manual iteration with retain()

This commit is contained in:
Manish Goregaokar 2017-10-23 14:24:16 -07:00
parent f61151a726
commit 44f16452b6
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98

View file

@ -168,11 +168,7 @@ where
return;
}
self.index.retain(|key| !set.contains(key));
// XXX It may be better to use retain when we back to use a
// normal hashmap rather than DiagnosticHashMap.
for key in set.iter() {
self.values.remove(key);
}
self.values.retain(|key, _| !set.contains(key));
debug_assert_eq!(self.values.len(), self.index.len());
}
}