Skip to content

Instantly share code, notes, and snippets.

@stepancheg
Created November 30, 2023 08:12
Show Gist options
  • Save stepancheg/45801920029fa8a155c5b746d98ca9a7 to your computer and use it in GitHub Desktop.
Save stepancheg/45801920029fa8a155c5b746d98ca9a7 to your computer and use it in GitHub Desktop.
diff --git a/crates/bevy_ecs/src/storage/table.rs b/crates/bevy_ecs/src/storage/table.rs
index 4b9ebc293..8784693d9 100644
--- a/crates/bevy_ecs/src/storage/table.rs
+++ b/crates/bevy_ecs/src/storage/table.rs
@@ -56,7 +56,7 @@ impl TableId {
/// Will panic if the provided value does not fit within a [`u32`] with `debug_assertions`.
#[inline]
pub const fn from_usize(index: usize) -> Self {
- debug_assert!(index as u32 as usize == index);
+ assert!(index as u32 as usize == index);
Self(index as u32)
}
@@ -73,7 +73,7 @@ impl TableId {
/// Will panic if the inner value does not fit within a [`usize`] with `debug_assertions`.
#[inline]
pub const fn as_usize(self) -> usize {
- debug_assert!(self.0 as usize as u32 == self.0);
+ assert!(self.0 as usize as u32 == self.0);
self.0 as usize
}
@@ -120,7 +120,7 @@ impl TableRow {
/// Will panic if the provided value does not fit within a [`u32`] with `debug_assertions`.
#[inline]
pub const fn from_usize(index: usize) -> Self {
- debug_assert!(index as u32 as usize == index);
+ assert!(index as u32 as usize == index);
Self(index as u32)
}
@@ -131,7 +131,7 @@ impl TableRow {
/// Will panic if the inner value does not fit within a [`usize`] with `debug_assertions`.
#[inline]
pub const fn as_usize(self) -> usize {
- debug_assert!(self.0 as usize as u32 == self.0);
+ assert!(self.0 as usize as u32 == self.0);
self.0 as usize
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment