Skip to content

Commit

Permalink
Simplify match conditions. (#1151)
Browse files Browse the repository at this point in the history
Use `Err(io::Errno::NOSYS)` inistead of
`Err(err) if err == io::Errno::NOSYS)`.
  • Loading branch information
sunfishcode authored Sep 5, 2024
1 parent 16dcb8d commit bd86a90
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/fs/statx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use compat::statx as _statx;
/// let present = (r.stx_attributes_mask & mountroot_flag) > 0;
/// Ok(present.then(|| r.stx_attributes & mountroot_flag > 0))
/// }
/// Err(e) if e == rustix::io::Errno::NOSYS => Ok(None),
/// Err(rustix::io::Errno::NOSYS) => Ok(None),
/// Err(e) => Err(e.into()),
/// }
/// }
Expand Down
2 changes: 1 addition & 1 deletion tests/fs/renameat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn test_renameat_with() {

match renameat_with(&dir, "file", &dir, "red", RenameFlags::empty()) {
Ok(()) => (),
Err(err) if err == rustix::io::Errno::NOSYS => return,
Err(rustix::io::Errno::NOSYS) => return,
Err(err) => unreachable!("unexpected error from renameat_with: {:?}", err),
}

Expand Down
4 changes: 2 additions & 2 deletions tests/process/pidfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn test_pidfd_waitid() {
let pid = process::Pid::from_child(&child);
let pidfd = match process::pidfd_open(pid, process::PidfdFlags::empty()) {
Ok(pidfd) => pidfd,
Err(e) if e == io::Errno::NOSYS => {
Err(io::Errno::NOSYS) => {
// The kernel does not support pidfds.
return;
}
Expand Down Expand Up @@ -59,7 +59,7 @@ fn test_pidfd_poll() {
let pid = process::Pid::from_child(&child);
let pidfd = match process::pidfd_open(pid, process::PidfdFlags::NONBLOCK) {
Ok(pidfd) => pidfd,
Err(e) if e == io::Errno::NOSYS || e == io::Errno::INVAL => {
Err(io::Errno::NOSYS) | Err(io::Errno::INVAL) => {
// The kernel does not support non-blocking pidfds.
return;
}
Expand Down

0 comments on commit bd86a90

Please sign in to comment.