Skip to content

Commit 5df7d69

Browse files
committed
miscellaneous simplifications
1 parent 3517a72 commit 5df7d69

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

crates/bevy_ecs/src/entity/entity_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub struct UniqueEntityIter<I: Iterator<Item: EntityEquivalent>> {
373373
impl<I: EntitySetIterator> UniqueEntityIter<I> {
374374
/// Constructs a `UniqueEntityIter` from an [`EntitySetIterator`].
375375
#[inline]
376-
pub const fn from_entity_set_iter<S>(iter: I) -> Self {
376+
pub const fn from_entity_set_iter(iter: I) -> Self {
377377
// SAFETY: iter implements `EntitySetIterator`.
378378
unsafe { Self::from_iter_unchecked(iter) }
379379
}

crates/bevy_ecs/src/entity/hash_set.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ impl EntityHashSet {
4545
Self(HashSet::with_capacity_and_hasher(n, EntityHash))
4646
}
4747

48-
/// Returns the number of elements in the set.
49-
#[inline]
50-
pub fn len(&self) -> usize {
51-
self.0.len()
52-
}
53-
5448
/// Returns `true` if the set contains no elements.
5549
#[inline]
5650
pub fn is_empty(&self) -> bool {

crates/bevy_ecs/src/entity/unique_array.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,14 @@ impl<T: EntityEquivalent, const N: usize> Deref for UniqueEntityEquivalentArray<
158158

159159
#[inline]
160160
fn deref(&self) -> &Self::Target {
161-
// SAFETY: All elements in the original array are unique.
162-
unsafe { UniqueEntityEquivalentSlice::from_slice_unchecked(&self.0) }
161+
self.as_slice()
163162
}
164163
}
165164

166165
impl<T: EntityEquivalent, const N: usize> DerefMut for UniqueEntityEquivalentArray<T, N> {
167166
#[inline]
168167
fn deref_mut(&mut self) -> &mut Self::Target {
169-
// SAFETY: All elements in the original array are unique.
170-
unsafe { UniqueEntityEquivalentSlice::from_slice_unchecked_mut(&mut self.0) }
168+
self.as_mut_slice()
171169
}
172170
}
173171

crates/bevy_ecs/src/relationship/relationship_source_collection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl RelationshipSourceCollection for EntityHashSet {
262262
}
263263

264264
fn len(&self) -> usize {
265-
self.len()
265+
self.deref().len()
266266
}
267267

268268
fn clear(&mut self) {

0 commit comments

Comments
 (0)