diff --git a/common/src/fileutils.rs b/common/src/fileutils.rs index cabeb833c..67713c014 100644 --- a/common/src/fileutils.rs +++ b/common/src/fileutils.rs @@ -320,7 +320,7 @@ pub mod windows { .get_or_init(|| { let library_name = OsString::from("api-ms-win-core-file-l2-1-4").to_wide_with_nul(); let module = unsafe { LoadLibraryW(library_name.as_ptr()) }; - if module == std::ptr::null_mut() { + if module.is_null() { return None; } let name = CString::new("GetFileInformationByName").unwrap(); diff --git a/stdlib/src/overlapped.rs b/stdlib/src/overlapped.rs index 8877e5bef..234e3be53 100644 --- a/stdlib/src/overlapped.rs +++ b/stdlib/src/overlapped.rs @@ -130,7 +130,7 @@ mod _overlapped { fn mark_as_completed(ov: &mut OVERLAPPED) { ov.Internal = 0; - if ov.hEvent != std::ptr::null_mut() { + if !ov.hEvent.is_null() { unsafe { windows_sys::Win32::System::Threading::SetEvent(ov.hEvent) }; } } @@ -263,7 +263,7 @@ mod _overlapped { type Args = (isize,); fn py_new(cls: PyTypeRef, (mut event,): Self::Args, vm: &VirtualMachine) -> PyResult { - if event as isize == INVALID_HANDLE_VALUE as isize { + if event == INVALID_HANDLE_VALUE(vm) { event = unsafe { windows_sys::Win32::System::Threading::CreateEventA( std::ptr::null(), @@ -272,7 +272,7 @@ mod _overlapped { std::ptr::null(), ) as isize }; - if event as isize == NULL { + if event == NULL { return Err(errno_err(vm)); } } diff --git a/vm/src/stdlib/nt.rs b/vm/src/stdlib/nt.rs index bf7dca8b0..ecc63e0aa 100644 --- a/vm/src/stdlib/nt.rs +++ b/vm/src/stdlib/nt.rs @@ -150,7 +150,7 @@ pub(crate) mod module { } let h = unsafe { Threading::OpenProcess(Threading::PROCESS_ALL_ACCESS, 0, pid) }; - if h == std::ptr::null_mut() { + if h.is_null() { return Err(errno_err(vm)); } let ret = unsafe { Threading::TerminateProcess(h, sig) }; @@ -172,7 +172,7 @@ pub(crate) mod module { _ => return Err(vm.new_value_error("bad file descriptor".to_owned())), }; let h = unsafe { Console::GetStdHandle(stdhandle) }; - if h == std::ptr::null_mut() { + if h.is_null() { return Err(vm.new_os_error("handle cannot be retrieved".to_owned())); } if h == INVALID_HANDLE_VALUE {