diff --git a/crates/spirv_backend/src/support.rs b/crates/spirv_backend/src/support.rs index c91cd31..60c951f 100644 --- a/crates/spirv_backend/src/support.rs +++ b/crates/spirv_backend/src/support.rs @@ -23,7 +23,7 @@ impl<'a, T> Index for SizedArray<&'a RuntimeArray> { type Output=T; fn index(&self, idx: usize) -> &Self::Output { - assert!(idx < self.len); + debug_assert!(idx < self.len); unsafe { self.items.index(idx) } @@ -34,7 +34,7 @@ impl<'a, T> Index for SizedArray<&'a mut RuntimeArray> { type Output=T; fn index(&self, idx: usize) -> &Self::Output { - assert!(idx < self.len); + debug_assert!(idx < self.len); unsafe { self.items.index(idx) } @@ -42,7 +42,7 @@ impl<'a, T> Index for SizedArray<&'a mut RuntimeArray> { } impl<'a, T> IndexMut for SizedArray<&'a mut RuntimeArray> { fn index_mut(&mut self, idx: usize) -> &mut Self::Output { - assert!(idx < self.len); + debug_assert!(idx < self.len); unsafe { self.items.index_mut(idx) } diff --git a/crates/types/src/compound/optional.rs b/crates/types/src/compound/optional.rs index 9282ad6..40badf3 100644 --- a/crates/types/src/compound/optional.rs +++ b/crates/types/src/compound/optional.rs @@ -43,7 +43,7 @@ impl Optional { pub fn and_then Optional>(self, f: F) -> Optional { if self.present != 0 { - f(self.unwrap()) + f(self.data) } else { Optional::none() } @@ -51,7 +51,7 @@ impl Optional { pub fn unwrap_or(self, default: T) -> T { if self.present != 0 { - self.unwrap() + self.data } else { default } @@ -77,7 +77,7 @@ impl Default for Optional { impl Optional<(T0, T1)> { pub fn flatten((f0, f1): (Optional, Optional)) -> Self { if f0.present != 0 && f1.present != 0 { - Optional::some((f0.unwrap(), f1.unwrap())) + Optional::some((f0.data, f1.data)) } else { Optional::none() } @@ -92,7 +92,7 @@ impl Optional<(T0, T1)> { impl Into> for Optional { fn into(self) -> Option { if self.present != 0 { - Some(self.unwrap()) + Some(self.data) } else { None }