remove unsound DerefMut impls from EntityHashMap/EntityHashSet (#17450)

# Objective

Noticed while doing #17449, I had left these `DerefMut` impls in.
Obtaining mutable references to those inner iterator types allows for
`mem::swap`, which can be used to swap an incorrectly behaving instance
into the wrappers.

## Solution

Remove them!
This commit is contained in:
Vic 2025-01-20 22:28:28 +01:00 committed by GitHub
parent 5a9bc28502
commit 59657ed1e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 36 deletions

View File

@ -169,12 +169,6 @@ impl<'a, V> Deref for Keys<'a, V> {
}
}
impl<V> DerefMut for Keys<'_, V> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<'a, V> Iterator for Keys<'a, V> {
type Item = &'a Entity;
@ -233,12 +227,6 @@ impl<V> Deref for IntoKeys<V> {
}
}
impl<V> DerefMut for IntoKeys<V> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<V> Iterator for IntoKeys<V> {
type Item = Entity;

View File

@ -217,12 +217,6 @@ impl<'a> Deref for Iter<'a> {
}
}
impl DerefMut for Iter<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<'a> Iterator for Iter<'a> {
type Item = &'a Entity;
@ -278,12 +272,6 @@ impl Deref for IntoIter {
}
}
impl DerefMut for IntoIter {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl Iterator for IntoIter {
type Item = Entity;
@ -336,12 +324,6 @@ impl<'a> Deref for Drain<'a> {
}
}
impl DerefMut for Drain<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<'a> Iterator for Drain<'a> {
type Item = Entity;
@ -391,12 +373,6 @@ impl<'a, F: FnMut(&Entity) -> bool> Deref for ExtractIf<'a, F> {
}
}
impl<F: FnMut(&Entity) -> bool> DerefMut for ExtractIf<'_, F> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<'a, F: FnMut(&Entity) -> bool> Iterator for ExtractIf<'a, F> {
type Item = Entity;