Skip to content

Commit 1e9a3dd

Browse files
FurryRcakebaker
andauthored
refactor(pidwait): merge suggestions
Co-authored-by: Daniel Hofstetter <[email protected]>
1 parent 76310ac commit 1e9a3dd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/uu/pidwait/src/platform/linux.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ pub fn wait(procs: &[ProcessInformation], timeout: Option<Duration>) -> Result<O
2828
let pidfd = pidfd_open(pid, PidfdFlags::empty())?;
2929
pidfds.push(pidfd);
3030
}
31-
let timespec = match timeout {
32-
Some(timeout) => Some(timeout.try_into().map_err(|_| Errno::INVAL)?),
33-
None => None,
34-
};
31+
let timespec = timeout
32+
.map(|t| t.try_into().map_err(|_| Errno::INVAL))
33+
.transpose()?;
3534
let mut fds: Vec<PollFd> = Vec::with_capacity(pidfds.len());
3635
for pidfd in &pidfds {
3736
fds.push(PollFd::new(pidfd, PollFlags::IN));

0 commit comments

Comments
 (0)