Fix unused_unsafe warning since Rust 1.61 nightly (#596)

This commit is contained in:
Zhixing Zhang 2022-03-15 01:28:23 -07:00 committed by GitHub
parent 3c7615b3bb
commit 79a2ef040b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,7 +143,7 @@ impl Entry {
/// `static_fn` must contain valid function pointers that comply with the semantics specified by /// `static_fn` must contain valid function pointers that comply with the semantics specified by
/// Vulkan 1.0, which must remain valid for at least the lifetime of the returned [`Entry`]. /// Vulkan 1.0, which must remain valid for at least the lifetime of the returned [`Entry`].
pub unsafe fn from_static_fn(static_fn: vk::StaticFn) -> Self { pub unsafe fn from_static_fn(static_fn: vk::StaticFn) -> Self {
let load_fn = |name: &std::ffi::CStr| unsafe { let load_fn = |name: &std::ffi::CStr| {
mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr())) mem::transmute(static_fn.get_instance_proc_addr(vk::Instance::null(), name.as_ptr()))
}; };
let entry_fn_1_0 = vk::EntryFnV1_0::load(load_fn); let entry_fn_1_0 = vk::EntryFnV1_0::load(load_fn);