Skip to content

Commit d2bf317

Browse files
arihant2mathcoolreader18
authored andcommitted
fix clippy
1 parent b4929d2 commit d2bf317

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

common/src/fileutils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ pub mod windows {
320320
.get_or_init(|| {
321321
let library_name = OsString::from("api-ms-win-core-file-l2-1-4").to_wide_with_nul();
322322
let module = unsafe { LoadLibraryW(library_name.as_ptr()) };
323-
if module == std::ptr::null_mut() {
323+
if module.is_null() {
324324
return None;
325325
}
326326
let name = CString::new("GetFileInformationByName").unwrap();

stdlib/src/overlapped.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ mod _overlapped {
130130

131131
fn mark_as_completed(ov: &mut OVERLAPPED) {
132132
ov.Internal = 0;
133-
if ov.hEvent != std::ptr::null_mut() {
133+
if !ov.hEvent.is_null() {
134134
unsafe { windows_sys::Win32::System::Threading::SetEvent(ov.hEvent) };
135135
}
136136
}
@@ -263,7 +263,7 @@ mod _overlapped {
263263
type Args = (isize,);
264264

265265
fn py_new(cls: PyTypeRef, (mut event,): Self::Args, vm: &VirtualMachine) -> PyResult {
266-
if event as isize == INVALID_HANDLE_VALUE as isize {
266+
if event == INVALID_HANDLE_VALUE(vm) {
267267
event = unsafe {
268268
windows_sys::Win32::System::Threading::CreateEventA(
269269
std::ptr::null(),
@@ -272,7 +272,7 @@ mod _overlapped {
272272
std::ptr::null(),
273273
) as isize
274274
};
275-
if event as isize == NULL {
275+
if event == NULL {
276276
return Err(errno_err(vm));
277277
}
278278
}

vm/src/stdlib/nt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub(crate) mod module {
150150
}
151151

152152
let h = unsafe { Threading::OpenProcess(Threading::PROCESS_ALL_ACCESS, 0, pid) };
153-
if h == std::ptr::null_mut() {
153+
if h.is_null() {
154154
return Err(errno_err(vm));
155155
}
156156
let ret = unsafe { Threading::TerminateProcess(h, sig) };
@@ -172,7 +172,7 @@ pub(crate) mod module {
172172
_ => return Err(vm.new_value_error("bad file descriptor".to_owned())),
173173
};
174174
let h = unsafe { Console::GetStdHandle(stdhandle) };
175-
if h == std::ptr::null_mut() {
175+
if h.is_null() {
176176
return Err(vm.new_os_error("handle cannot be retrieved".to_owned()));
177177
}
178178
if h == INVALID_HANDLE_VALUE {

0 commit comments

Comments
 (0)