diff --git a/derive/src/util.rs b/derive/src/util.rs index a0d848b69..fff2a403b 100644 --- a/derive/src/util.rs +++ b/derive/src/util.rs @@ -67,7 +67,7 @@ impl ItemNursery { if !inserted { return Err(syn::Error::new( item.attr_name.span(), - &format!("Duplicated #[py*] attribute found for {:?}", &item.py_names), + format!("Duplicated #[py*] attribute found for {:?}", &item.py_names), )); } } diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 6862ad0af..210cc3f82 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1109,7 +1109,7 @@ pub(super) mod _os { // TODO: replicate CPython's win32_xstat let [] = dir_fd.0; let meta = match file { - PathOrFd::Path(path) => super::fs_metadata(&path, follow_symlinks.0)?, + PathOrFd::Path(path) => super::fs_metadata(path, follow_symlinks.0)?, PathOrFd::Fd(fno) => { use std::os::windows::io::FromRawHandle; let handle = Fd(fno).to_raw_handle()?; @@ -1521,9 +1521,10 @@ pub(super) mod _os { }; let tick_for_second = unsafe { libc::sysconf(libc::_SC_CLK_TCK) } as f64; - let c = unsafe { libc::times(&mut t as *mut _) } as i64; + let c = unsafe { libc::times(&mut t as *mut _) }; - if c == -1 { + // XXX: The signedness of `clock_t` varies from platform to platform. + if c == (-1i8) as libc::clock_t { return Err(vm.new_os_error("Fail to get times".to_string())); } diff --git a/vm/src/stdlib/winreg.rs b/vm/src/stdlib/winreg.rs index 17a430fd6..660df63da 100644 --- a/vm/src/stdlib/winreg.rs +++ b/vm/src/stdlib/winreg.rs @@ -258,7 +258,7 @@ mod winreg { value: PyStrRef, vm: &VirtualMachine, ) -> PyResult<()> { - if typ != REG_SZ as u32 { + if typ != REG_SZ { return Err(vm.new_type_error("type must be winreg.REG_SZ".to_owned())); } let subkey = subkey.as_ref().map_or("", |s| s.as_str());