diff --git a/src/timer/windows_timer.rs b/src/timer/windows_timer.rs index 4363990..e48e288 100644 --- a/src/timer/windows_timer.rs +++ b/src/timer/windows_timer.rs @@ -34,11 +34,11 @@ use crate::quantity::{nanosecond, Information, Time, Zero}; #[cfg(not(feature = "windows_process_extensions_main_thread_handle"))] #[allow(non_upper_case_globals)] -static NtResumeProcess: Lazy NTSTATUS> = +static NtResumeProcess: Lazy NTSTATUS> = Lazy::new(|| { // SAFETY: Getting the module handle for ntdll.dll is safe let ntdll = unsafe { GetModuleHandleW(w!("ntdll.dll")) }; - assert!(ntdll != std::ptr::null_mut(), "GetModuleHandleW failed"); + assert!(!ntdll.is_null(), "GetModuleHandleW failed"); // SAFETY: The ntdll handle is valid let nt_resume_process = unsafe { GetProcAddress(ntdll, s!("NtResumeProcess")) }; @@ -57,10 +57,7 @@ impl CPUTimer { // SAFETY: Creating a new job object is safe let job_object = unsafe { CreateJobObjectW(ptr::null_mut(), ptr::null_mut()) }; - assert!( - job_object != std::ptr::null_mut(), - "CreateJobObjectW failed" - ); + assert!(!job_object.is_null(), "CreateJobObjectW failed"); // SAFETY: The job object handle is valid let ret = unsafe { AssignProcessToJobObject(job_object, child_handle) };