Skip to content

Commit 6331456

Browse files
committed
refactor: Fix clippy warnings
1 parent 1d4c414 commit 6331456

File tree

13 files changed

+32
-38
lines changed

13 files changed

+32
-38
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Without them, this project would not be what it is today.
173173
- [@Celeo](https://github.com/Celeo) - _Celeo_
174174
- [@FedericoPonzi](https://github.com/FedericoPonzi) - _Federico Ponzi_
175175
- [@Larisho](https://github.com/Larisho) - _Gab David_
176-
- [@silverweed](https://github.com/silverweed) - _Giacomo Parolini_
176+
- [@silverweed](https://github.com/silverweed)
177177
- [@marcospb19](https://github.com/marcospb19) - _João M. Bezerra_
178178
- [@kegesch](https://github.com/kegesch) - _Jonas Geschke_
179179
- Ladysamantha

basename/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
.read(true)
2929
.write(true)
3030
.create(true)
31+
.truncate(false)
3132
.open(file_name)
3233
.expect("Unable to open file"),
3334
);

cat/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn main() {
2727
.read(true)
2828
.write(true)
2929
.create(true)
30+
.truncate(false)
3031
.open(file_name)
3132
.expect("Unable to open file"),
3233
);

chroot/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
.read(true)
2929
.write(true)
3030
.create(true)
31+
.truncate(false)
3132
.open(file_name)
3233
.expect("Unable to open file"),
3334
);

clear/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
.read(true)
2929
.write(true)
3030
.create(true)
31+
.truncate(false)
3132
.open(file_name)
3233
.expect("Unable to open file"),
3334
);

clear/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::{
2-
io::{stdout, Write},
2+
io::{Write, stdout},
33
process,
44
};
55

@@ -11,7 +11,7 @@ fn main() {
1111
let x_flag = matches.is_present("x");
1212

1313
if x_flag {
14-
match stdout().lock().write(b"\x1b[H\x1b[3J") {
14+
match stdout().lock().write_all(b"\x1b[H\x1b[3J") {
1515
Ok(_) => (),
1616
Err(err) => {
1717
eprintln!("clear: failed to execute: {}", err);
@@ -21,7 +21,7 @@ fn main() {
2121
return;
2222
}
2323

24-
match stdout().lock().write(b"\x1b[3J\x1b[H\x1b[2J") {
24+
match stdout().lock().write_all(b"\x1b[3J\x1b[H\x1b[2J") {
2525
Ok(_) => (),
2626
Err(err) => {
2727
eprintln!("clear: failed to execute: {}", err);

coreutils_core/src/backup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl From<&str> for BackupMode {
105105
pub fn create_numbered_backup(file: &Path) -> Result<PathBuf, Error> {
106106
let mut index = 1_u64;
107107
loop {
108-
if index == std::u64::MAX {
108+
if index == u64::MAX {
109109
return Err(Error::new(
110110
ErrorKind::AlreadyExists,
111111
"Cannot create backup: too many backup files",

coreutils_core/src/os/audit.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ extern "C" {
149149
#[inline]
150150
pub fn audit_info() -> io::Result<AuditInfo> {
151151
let mut auditinfo: MaybeUninit<AuditInfo> = MaybeUninit::zeroed();
152-
let address = auditinfo.as_mut_ptr() as *mut AuditInfo;
153152

154-
if unsafe { getaudit(address) } == -1 {
153+
if unsafe { getaudit(auditinfo.as_mut_ptr()) } == -1 {
155154
return Err(io::Error::last_os_error());
156155
}
157156

coreutils_core/src/os/resource.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Also holds utility functions for summarizing the data returned by getrusage(2)
44
#[cfg(not(target_os = "fuchsia"))]
55
use libc::getrusage;
6-
use libc::{c_int, rusage, RUSAGE_CHILDREN, RUSAGE_SELF};
6+
use libc::{RUSAGE_CHILDREN, RUSAGE_SELF, c_int, rusage};
77
use time::Duration;
88

99
use super::TimeVal;
@@ -69,6 +69,7 @@ pub struct IOUsage {
6969
pub num_signals: u64,
7070
}
7171

72+
#[allow(clippy::unnecessary_cast, reason = "OS divergence")]
7273
fn timeval_to_duration(t: TimeVal) -> Duration {
7374
// This type cast is realistically safe because the number of
7475
// microseconds in a second cannot exceed `1e+6`, which at

csplit/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn main() {
2828
.read(true)
2929
.write(true)
3030
.create(true)
31+
.truncate(false)
3132
.open(file_name)
3233
.expect("Unable to open file"),
3334
);

0 commit comments

Comments
 (0)