Skip to content

Commit 3007c11

Browse files
committed
remove dead code in blob_vec.rs
1 parent 8aaf1a3 commit 3007c11

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

crates/bevy_ecs/src/storage/blob_vec.rs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use alloc::alloc::handle_alloc_error;
22
use bevy_ptr::{OwningPtr, Ptr, PtrMut};
33
use bevy_utils::OnDrop;
4-
use core::{alloc::Layout, cell::UnsafeCell, num::NonZero, ptr::NonNull};
4+
use core::{alloc::Layout, num::NonZero, ptr::NonNull};
55

66
/// A flat, type-erased data storage type
77
///
@@ -88,12 +88,6 @@ impl BlobVec {
8888
self.len == 0
8989
}
9090

91-
/// Returns the [`Layout`] of the element type stored in the vector.
92-
#[inline]
93-
pub fn layout(&self) -> Layout {
94-
self.item_layout
95-
}
96-
9791
/// Reserves the minimum capacity for at least `additional` more elements to be inserted in the given `BlobVec`.
9892
/// After calling `reserve_exact`, capacity will be greater than or equal to `self.len() + additional`. Does nothing if
9993
/// the capacity is already sufficient.
@@ -293,22 +287,6 @@ impl BlobVec {
293287
unsafe { p.promote() }
294288
}
295289

296-
/// Removes the value at `index` and drops it.
297-
/// Does not do any bounds checking on `index`.
298-
/// The removed element is replaced by the last element of the `BlobVec`.
299-
///
300-
/// # Safety
301-
/// It is the caller's responsibility to ensure that `index` is `< self.len()`.
302-
#[inline]
303-
pub unsafe fn swap_remove_and_drop_unchecked(&mut self, index: usize) {
304-
debug_assert!(index < self.len());
305-
let drop = self.drop;
306-
let value = self.swap_remove_and_forget_unchecked(index);
307-
if let Some(drop) = drop {
308-
drop(value);
309-
}
310-
}
311-
312290
/// Returns a reference to the element at `index`, without doing bounds checking.
313291
///
314292
/// # Safety
@@ -357,15 +335,6 @@ impl BlobVec {
357335
unsafe { PtrMut::new(self.data) }
358336
}
359337

360-
/// Get a reference to the entire [`BlobVec`] as if it were an array with elements of type `T`
361-
///
362-
/// # Safety
363-
/// The type `T` must be the type of the items in this [`BlobVec`].
364-
pub unsafe fn get_slice<T>(&self) -> &[UnsafeCell<T>] {
365-
// SAFETY: the inner data will remain valid for as long as 'self.
366-
unsafe { core::slice::from_raw_parts(self.data.as_ptr() as *const UnsafeCell<T>, self.len) }
367-
}
368-
369338
/// Clears the vector, removing (and dropping) all values.
370339
///
371340
/// Note that this method has no effect on the allocated capacity of the vector.

crates/bevy_ecs/src/storage/sparse_set.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ use crate::{
66
};
77
use alloc::{boxed::Box, vec::Vec};
88
use bevy_ptr::{OwningPtr, Ptr};
9-
use core::{
10-
cell::UnsafeCell,
11-
hash::Hash,
12-
marker::PhantomData,
13-
num::{NonZero, NonZeroUsize},
14-
panic::Location,
15-
};
9+
use core::{cell::UnsafeCell, hash::Hash, marker::PhantomData, num::NonZeroUsize, panic::Location};
1610
use nonmax::NonMaxUsize;
1711

1812
use super::{abort_on_panic, ThinColumn};

0 commit comments

Comments
 (0)