capi: use unwrap_unchecked when we're certain a value is not null.

This commit is contained in:
chyyran 2023-02-16 18:23:56 -05:00
parent 8ed244f6fa
commit a6b1e0a412
2 changed files with 2 additions and 3 deletions

View file

@ -223,14 +223,14 @@ macro_rules! assert_some_ptr {
return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export();
}
let $value = unsafe { $value.as_ref().unwrap().as_ref() };
let $value = unsafe { $value.as_ref().unwrap_unchecked().as_ref() };
};
(mut $value:ident) => {
if $value.is_none() {
return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export();
}
let $value = unsafe { $value.as_mut().unwrap().as_mut() };
let $value = unsafe { $value.as_mut().unwrap_unchecked().as_mut() };
};
}

View file

@ -1,4 +1,3 @@
use std::iter::Filter;
use crate::descriptor_heap::{D3D12DescriptorHeap, D3D12DescriptorHeapSlot, SamplerPaletteHeap};
use crate::error;
use librashader_common::{FilterMode, WrapMode};