forked from Rust-related/RustPython
fix clippy
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user