1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

fix clippy (#8275)

* fix clippy

* update

* update
This commit is contained in:
Luv-Ray 2025-06-27 15:15:24 +08:00 committed by GitHub
parent 507e1cc09b
commit fb2399f56b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 25 additions and 19 deletions

View file

@ -463,7 +463,7 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
tv_nsec: ts.subsec_nanosecond() as _,
};
let result = unsafe { clock_settime(CLOCK_REALTIME, &timespec) };
let result = unsafe { clock_settime(CLOCK_REALTIME, &raw const timespec) };
if result == 0 {
Ok(())
@ -492,7 +492,7 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
wMilliseconds: ((date.subsec_nanosecond() / 1_000_000) % 1000) as u16,
};
let result = unsafe { SetSystemTime(&system_time) };
let result = unsafe { SetSystemTime(&raw const system_time) };
if result == 0 {
Err(std::io::Error::last_os_error()

View file

@ -230,7 +230,7 @@ fn get_size_on_disk(path: &Path) -> u64 {
unsafe {
let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed();
let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info;
let file_info_ptr: *mut FILE_STANDARD_INFO = &raw mut file_info;
let success = GetFileInformationByHandleEx(
file.as_raw_handle() as HANDLE,
@ -257,7 +257,7 @@ fn get_file_info(path: &Path) -> Option<FileInfo> {
unsafe {
let mut file_info: FILE_ID_INFO = core::mem::zeroed();
let file_info_ptr: *mut FILE_ID_INFO = &mut file_info;
let file_info_ptr: *mut FILE_ID_INFO = &raw mut file_info;
let success = GetFileInformationByHandleEx(
file.as_raw_handle() as HANDLE,

View file

@ -1077,7 +1077,7 @@ fn get_rlimit() -> UResult<usize> {
rlim_cur: 0,
rlim_max: 0,
};
match unsafe { getrlimit(RLIMIT_NOFILE, &mut limit) } {
match unsafe { getrlimit(RLIMIT_NOFILE, &raw mut limit) } {
0 => Ok(limit.rlim_cur as usize),
_ => Err(UUsageError::new(2, get_message("sort-failed-fetch-rlimit"))),
}

View file

@ -14,7 +14,7 @@ pub fn get_username() -> io::Result<OsString> {
let mut buffer = [0_u16; BUF_LEN as usize];
let mut len = BUF_LEN;
// SAFETY: buffer.len() == len
if unsafe { GetUserNameW(buffer.as_mut_ptr(), &mut len) } == 0 {
if unsafe { GetUserNameW(buffer.as_mut_ptr(), &raw mut len) } == 0 {
return Err(io::Error::last_os_error());
}
Ok(OsString::from_wide(&buffer[..len as usize - 1]))

View file

@ -220,8 +220,14 @@ impl Passwd {
let name = CString::new(self.name.as_bytes()).unwrap();
loop {
ngroups_old = ngroups;
if unsafe { getgrouplist(name.as_ptr(), self.gid, groups.as_mut_ptr(), &mut ngroups) }
== -1
if unsafe {
getgrouplist(
name.as_ptr(),
self.gid,
groups.as_mut_ptr(),
&raw mut ngroups,
)
} == -1
{
if ngroups == ngroups_old {
ngroups *= 2;

View file

@ -814,7 +814,7 @@ impl FsMeta for StatFs {
fn fsid(&self) -> u64 {
// Use type inference to determine the type of f_fsid
// (libc::__fsid_t on Android, libc::fsid_t on other platforms)
let f_fsid: &[u32; 2] = unsafe { &*(&self.f_fsid as *const _ as *const [u32; 2]) };
let f_fsid: &[u32; 2] = unsafe { &*(&raw const self.f_fsid as *const [u32; 2]) };
((u64::from(f_fsid[0])) << 32) | u64::from(f_fsid[1])
}
#[cfg(not(any(

View file

@ -562,7 +562,7 @@ fn test_write_fast_fallthrough_uses_flush() {
#[test]
#[cfg(unix)]
#[ignore]
#[ignore = ""]
fn test_domain_socket() {
use std::io::prelude::*;
use std::os::unix::net::UnixListener;

View file

@ -1856,7 +1856,7 @@ mod gnu_cksum_c {
}
#[test]
#[ignore]
#[ignore = "todo"]
fn test_signed_checksums() {
todo!()
}

View file

@ -309,7 +309,7 @@ fn zero_terminated_with_total() {
}
}
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
#[test]
fn check_order() {
let scene = TestScenario::new(util_name!());
@ -324,7 +324,7 @@ fn check_order() {
.stderr_is("error to be defined");
}
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
#[test]
fn nocheck_order() {
let scene = TestScenario::new(util_name!());
@ -340,7 +340,7 @@ fn nocheck_order() {
// when neither --check-order nor --no-check-order is provided,
// stderr and the error code behaves like check order, but stdout
// behaves like nocheck_order. However with some quirks detailed below.
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
#[test]
fn defaultcheck_order() {
let scene = TestScenario::new(util_name!());

View file

@ -396,7 +396,7 @@ fn test_null_fullblock() {
}
#[cfg(unix)]
#[ignore] // See note below before using this test.
#[ignore = "See note below before using this test."]
#[test]
fn test_fullblock() {
let tname = "fullblock-from-urand";
@ -555,7 +555,7 @@ fn test_ascii_521k_to_file() {
);
}
#[ignore]
#[ignore = ""]
#[cfg(unix)]
#[test]
fn test_ascii_5_gibi_to_file() {

View file

@ -1898,7 +1898,7 @@ fn test_ls_long_ctime() {
}
#[test]
#[ignore]
#[ignore = ""]
fn test_ls_order_birthtime() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;

View file

@ -943,7 +943,7 @@ fn test_parse_out_of_bounds_exponents() {
.stdout_only("-0\n1\n");
}
#[ignore]
#[ignore = ""]
#[test]
fn test_parse_valid_hexadecimal_float_format_issues() {
// These tests detect differences in the representation of floating-point values with GNU seq.

View file

@ -4888,7 +4888,7 @@ fn test_following_with_pid() {
// should fail with any command that takes piped input.
// See also https://github.com/uutils/coreutils/issues/3895
#[test]
#[cfg_attr(not(feature = "expensive_tests"), ignore)]
#[cfg_attr(not(feature = "expensive_tests"), ignore = "")]
fn test_when_piped_input_then_no_broken_pipe() {
let ts = TestScenario::new("tail");
for i in 0..10000 {