Skip to content

Commit 4bff09a

Browse files
Use io::Error::other() instead of io::Error::new(ErrorKind::Other, ...)
Replace io::Error::new(io::ErrorKind::Other, ...) with the more concise io::Error::other() helper method in kqueue implementations. Fixes clippy::io_other_error warnings on macOS builds.
1 parent a15f568 commit 4bff09a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/uu/timeout/src/timeout.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn wait_for_signal(signals: &[Signal], until: Option<Instant>) -> io::Result<Opt
292292
#[cfg(target_os = "macos")]
293293
fn wait_for_signal(signals: &[Signal], until: Option<Instant>) -> io::Result<Option<Signal>> {
294294
// Create a kqueue for signal monitoring
295-
let kq = Kqueue::new().map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
295+
let kq = Kqueue::new().map_err(|e| io::Error::other(e.to_string()))?;
296296

297297
// Create events for each signal we want to monitor
298298
let mut changelist = Vec::with_capacity(signals.len());
@@ -335,7 +335,7 @@ fn wait_for_signal(signals: &[Signal], until: Option<Instant>) -> io::Result<Opt
335335
let sig_num = eventlist[0].ident() as i32;
336336
Signal::try_from(sig_num)
337337
.map(Some)
338-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))
338+
.map_err(|e| io::Error::other(e.to_string()))
339339
}
340340
Ok(_) => {
341341
// Timeout expired with no events
@@ -345,7 +345,7 @@ fn wait_for_signal(signals: &[Signal], until: Option<Instant>) -> io::Result<Opt
345345
// Interrupted - retry
346346
wait_for_signal(signals, until)
347347
}
348-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
348+
Err(e) => Err(io::Error::other(e.to_string())),
349349
}
350350
}
351351

src/uucore/src/lib/features/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl ChildExt for Child {
221221
drop(self.stdin.take());
222222

223223
// Create kqueue for signal monitoring
224-
let kq = Kqueue::new().map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))?;
224+
let kq = Kqueue::new().map_err(|e| io::Error::other(e.to_string()))?;
225225

226226
// Create events for signals we want to monitor
227227
let mut changelist = Vec::with_capacity(2);
@@ -296,7 +296,7 @@ impl ChildExt for Child {
296296
Ok(None)
297297
}
298298
}
299-
Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
299+
Err(e) => Err(io::Error::other(e.to_string())),
300300
}
301301
}
302302
}

0 commit comments

Comments
 (0)