Skip to content

Commit fb2399f

Browse files
authored
fix clippy (#8275)
* fix clippy * update * update
1 parent 507e1cc commit fb2399f

File tree

13 files changed

+25
-19
lines changed

13 files changed

+25
-19
lines changed

src/uu/date/src/date.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
463463
tv_nsec: ts.subsec_nanosecond() as _,
464464
};
465465

466-
let result = unsafe { clock_settime(CLOCK_REALTIME, &timespec) };
466+
let result = unsafe { clock_settime(CLOCK_REALTIME, &raw const timespec) };
467467

468468
if result == 0 {
469469
Ok(())
@@ -492,7 +492,7 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
492492
wMilliseconds: ((date.subsec_nanosecond() / 1_000_000) % 1000) as u16,
493493
};
494494

495-
let result = unsafe { SetSystemTime(&system_time) };
495+
let result = unsafe { SetSystemTime(&raw const system_time) };
496496

497497
if result == 0 {
498498
Err(std::io::Error::last_os_error()

src/uu/du/src/du.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn get_size_on_disk(path: &Path) -> u64 {
230230

231231
unsafe {
232232
let mut file_info: FILE_STANDARD_INFO = core::mem::zeroed();
233-
let file_info_ptr: *mut FILE_STANDARD_INFO = &mut file_info;
233+
let file_info_ptr: *mut FILE_STANDARD_INFO = &raw mut file_info;
234234

235235
let success = GetFileInformationByHandleEx(
236236
file.as_raw_handle() as HANDLE,
@@ -257,7 +257,7 @@ fn get_file_info(path: &Path) -> Option<FileInfo> {
257257

258258
unsafe {
259259
let mut file_info: FILE_ID_INFO = core::mem::zeroed();
260-
let file_info_ptr: *mut FILE_ID_INFO = &mut file_info;
260+
let file_info_ptr: *mut FILE_ID_INFO = &raw mut file_info;
261261

262262
let success = GetFileInformationByHandleEx(
263263
file.as_raw_handle() as HANDLE,

src/uu/sort/src/sort.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ fn get_rlimit() -> UResult<usize> {
10771077
rlim_cur: 0,
10781078
rlim_max: 0,
10791079
};
1080-
match unsafe { getrlimit(RLIMIT_NOFILE, &mut limit) } {
1080+
match unsafe { getrlimit(RLIMIT_NOFILE, &raw mut limit) } {
10811081
0 => Ok(limit.rlim_cur as usize),
10821082
_ => Err(UUsageError::new(2, get_message("sort-failed-fetch-rlimit"))),
10831083
}

src/uu/whoami/src/platform/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn get_username() -> io::Result<OsString> {
1414
let mut buffer = [0_u16; BUF_LEN as usize];
1515
let mut len = BUF_LEN;
1616
// SAFETY: buffer.len() == len
17-
if unsafe { GetUserNameW(buffer.as_mut_ptr(), &mut len) } == 0 {
17+
if unsafe { GetUserNameW(buffer.as_mut_ptr(), &raw mut len) } == 0 {
1818
return Err(io::Error::last_os_error());
1919
}
2020
Ok(OsString::from_wide(&buffer[..len as usize - 1]))

src/uucore/src/lib/features/entries.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,14 @@ impl Passwd {
220220
let name = CString::new(self.name.as_bytes()).unwrap();
221221
loop {
222222
ngroups_old = ngroups;
223-
if unsafe { getgrouplist(name.as_ptr(), self.gid, groups.as_mut_ptr(), &mut ngroups) }
224-
== -1
223+
if unsafe {
224+
getgrouplist(
225+
name.as_ptr(),
226+
self.gid,
227+
groups.as_mut_ptr(),
228+
&raw mut ngroups,
229+
)
230+
} == -1
225231
{
226232
if ngroups == ngroups_old {
227233
ngroups *= 2;

src/uucore/src/lib/features/fsext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ impl FsMeta for StatFs {
814814
fn fsid(&self) -> u64 {
815815
// Use type inference to determine the type of f_fsid
816816
// (libc::__fsid_t on Android, libc::fsid_t on other platforms)
817-
let f_fsid: &[u32; 2] = unsafe { &*(&self.f_fsid as *const _ as *const [u32; 2]) };
817+
let f_fsid: &[u32; 2] = unsafe { &*(&raw const self.f_fsid as *const [u32; 2]) };
818818
((u64::from(f_fsid[0])) << 32) | u64::from(f_fsid[1])
819819
}
820820
#[cfg(not(any(

tests/by-util/test_cat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ fn test_write_fast_fallthrough_uses_flush() {
562562

563563
#[test]
564564
#[cfg(unix)]
565-
#[ignore]
565+
#[ignore = ""]
566566
fn test_domain_socket() {
567567
use std::io::prelude::*;
568568
use std::os::unix::net::UnixListener;

tests/by-util/test_cksum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ mod gnu_cksum_c {
18561856
}
18571857

18581858
#[test]
1859-
#[ignore]
1859+
#[ignore = "todo"]
18601860
fn test_signed_checksums() {
18611861
todo!()
18621862
}

tests/by-util/test_comm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ fn zero_terminated_with_total() {
309309
}
310310
}
311311

312-
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
312+
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
313313
#[test]
314314
fn check_order() {
315315
let scene = TestScenario::new(util_name!());
@@ -324,7 +324,7 @@ fn check_order() {
324324
.stderr_is("error to be defined");
325325
}
326326

327-
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
327+
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
328328
#[test]
329329
fn nocheck_order() {
330330
let scene = TestScenario::new(util_name!());
@@ -340,7 +340,7 @@ fn nocheck_order() {
340340
// when neither --check-order nor --no-check-order is provided,
341341
// stderr and the error code behaves like check order, but stdout
342342
// behaves like nocheck_order. However with some quirks detailed below.
343-
#[cfg_attr(not(feature = "test_unimplemented"), ignore)]
343+
#[cfg_attr(not(feature = "test_unimplemented"), ignore = "")]
344344
#[test]
345345
fn defaultcheck_order() {
346346
let scene = TestScenario::new(util_name!());

tests/by-util/test_dd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ fn test_null_fullblock() {
396396
}
397397

398398
#[cfg(unix)]
399-
#[ignore] // See note below before using this test.
399+
#[ignore = "See note below before using this test."]
400400
#[test]
401401
fn test_fullblock() {
402402
let tname = "fullblock-from-urand";
@@ -555,7 +555,7 @@ fn test_ascii_521k_to_file() {
555555
);
556556
}
557557

558-
#[ignore]
558+
#[ignore = ""]
559559
#[cfg(unix)]
560560
#[test]
561561
fn test_ascii_5_gibi_to_file() {

0 commit comments

Comments
 (0)