We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28982b9 commit fcb964bCopy full SHA for fcb964b
src/set.rs
@@ -1659,11 +1659,15 @@ where
1659
/// ```
1660
fn bitxor_assign(&mut self, rhs: &HashSet<T, S>) {
1661
for item in rhs {
1662
- if self.contains(item) {
1663
- self.remove(item);
1664
- } else {
1665
- self.insert(item.clone());
1666
- }
+ let entry = self.map.raw_entry_mut().from_key(item);
+ match entry {
+ map::RawEntryMut::Occupied(e) => {
+ e.remove();
+ }
1667
+ map::RawEntryMut::Vacant(e) => {
1668
+ e.insert(item.to_owned(), ());
1669
1670
+ };
1671
}
1672
1673
0 commit comments