Skip to content

Commit 6e908de

Browse files
authored
Merge pull request #3125 from youknowone/dewarnings
remove compiler warnings
2 parents 6b84c2b + 90eed30 commit 6e908de

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

vm/src/stdlib/nt.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,15 @@ pub(crate) mod module {
331331
fn _getdiskusage(path: PyPathLike, vm: &VirtualMachine) -> PyResult<(u64, u64)> {
332332
use um::fileapi::GetDiskFreeSpaceExW;
333333
use winapi::shared::{ntdef::ULARGE_INTEGER, winerror};
334+
334335
let wpath = path.to_widecstring(vm)?;
335336
let mut _free_to_me = ULARGE_INTEGER::default();
336337
let mut total = ULARGE_INTEGER::default();
337338
let mut free = ULARGE_INTEGER::default();
338339
let ret =
339340
unsafe { GetDiskFreeSpaceExW(wpath.as_ptr(), &mut _free_to_me, &mut total, &mut free) };
340341
if ret != 0 {
341-
return unsafe { Ok((*total.QuadPart(), *free.QuadPart())) };
342+
return Ok(unsafe { (*total.QuadPart(), *free.QuadPart()) });
342343
}
343344
let err = io::Error::last_os_error();
344345
if err.raw_os_error() == Some(winerror::ERROR_DIRECTORY as i32) {
@@ -349,14 +350,14 @@ pub(crate) mod module {
349350
GetDiskFreeSpaceExW(parent.as_ptr(), &mut _free_to_me, &mut total, &mut free)
350351
};
351352

352-
if ret == 0 {
353-
return Err(errno_err(vm));
353+
return if ret == 0 {
354+
Err(errno_err(vm))
354355
} else {
355-
return unsafe { Ok((*total.QuadPart(), *free.QuadPart())) };
356-
}
356+
Ok(unsafe { (*total.QuadPart(), *free.QuadPart()) })
357+
};
357358
}
358359
}
359-
return Err(err.into_pyexception(vm));
360+
Err(err.into_pyexception(vm))
360361
}
361362

362363
#[pyfunction]

vm/src/stdlib/posix.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,16 @@ pub(crate) fn make_module(vm: &VirtualMachine) -> PyObjectRef {
3131
pub mod module {
3232
use crate::{
3333
builtins::{int, PyDictRef, PyInt, PyListRef, PyStrRef, PyTupleRef, PyTypeRef},
34-
crt_fd::Offset,
3534
exceptions::IntoPyException,
36-
function::{FuncArgs, OptionalArg},
35+
function::OptionalArg,
3736
slots::SlotConstructor,
3837
stdlib::os::{
3938
errno_err, DirFd, FollowSymlinks, PathOrFd, PyPathLike, SupportFunc, TargetIsDirectory,
4039
_os, fs_metadata,
4140
},
4241
utils::{Either, ToCString},
43-
IntoPyObject, ItemProtocol, PyObjectRef, PyResult, PyValue, StaticType,
44-
TryFromBorrowedObject, TryFromObject, VirtualMachine,
42+
IntoPyObject, ItemProtocol, PyObjectRef, PyResult, PyValue, StaticType, TryFromObject,
43+
VirtualMachine,
4544
};
4645
use bitflags::bitflags;
4746
use nix::fcntl;
@@ -963,6 +962,8 @@ pub mod module {
963962
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
964963
impl PosixSpawnArgs {
965964
fn spawn(self, spawnp: bool, vm: &VirtualMachine) -> PyResult<libc::pid_t> {
965+
use crate::TryFromBorrowedObject;
966+
966967
let path = CString::new(self.path.into_bytes())
967968
.map_err(|_| vm.new_value_error("path should not have nul bytes".to_owned()))?;
968969

@@ -983,7 +984,7 @@ pub mod module {
983984
let id = PosixSpawnFileActionIdentifier::try_from(id).map_err(|_| {
984985
vm.new_type_error("Unknown file_actions identifier".to_owned())
985986
})?;
986-
let args = FuncArgs::from(args.to_vec());
987+
let args: crate::function::FuncArgs = args.to_vec().into();
987988
let ret = match id {
988989
PosixSpawnFileActionIdentifier::Open => {
989990
let (fd, path, oflag, mode): (_, PyPathLike, _, _) = args.bind(vm)?;
@@ -1567,7 +1568,7 @@ pub mod module {
15671568
#[pyarg(any)]
15681569
in_fd: i32,
15691570
#[pyarg(any)]
1570-
offset: Offset,
1571+
offset: crate::crt_fd::Offset,
15711572
#[pyarg(any)]
15721573
count: i64,
15731574
#[cfg(target_os = "macos")]

0 commit comments

Comments
 (0)