Fix clippy in windows.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2024-08-03 14:00:13 +10:00 committed by GitHub
parent a026dc2a4e
commit 744a358812
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
use std::{mem, ptr}; use std::mem;
use windows_sys::Win32::{ use windows_sys::Win32::{
Foundation::{HMODULE, S_OK}, Foundation::{HMODULE, S_OK},
System::{ System::{
@ -16,7 +16,7 @@ struct LibraryHandle(HMODULE);
impl LibraryHandle { impl LibraryHandle {
fn new(name: &[u8]) -> Option<Self> { fn new(name: &[u8]) -> Option<Self> {
let handle = unsafe { LoadLibraryA(name.as_ptr() as _) }; let handle = unsafe { LoadLibraryA(name.as_ptr() as _) };
(handle != ptr::null_mut()).then(|| Self(handle)) (!handle.is_null()).then_some(Self(handle))
} }
/// Get a function pointer to a function in the library. /// Get a function pointer to a function in the library.