Skip to content

Commit bd86a90

Browse files
authored
Simplify match conditions. (#1151)
Use `Err(io::Errno::NOSYS)` inistead of `Err(err) if err == io::Errno::NOSYS)`.
1 parent 16dcb8d commit bd86a90

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/fs/statx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use compat::statx as _statx;
4444
/// let present = (r.stx_attributes_mask & mountroot_flag) > 0;
4545
/// Ok(present.then(|| r.stx_attributes & mountroot_flag > 0))
4646
/// }
47-
/// Err(e) if e == rustix::io::Errno::NOSYS => Ok(None),
47+
/// Err(rustix::io::Errno::NOSYS) => Ok(None),
4848
/// Err(e) => Err(e.into()),
4949
/// }
5050
/// }

tests/fs/renameat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn test_renameat_with() {
100100

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

tests/process/pidfd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn test_pidfd_waitid() {
2222
let pid = process::Pid::from_child(&child);
2323
let pidfd = match process::pidfd_open(pid, process::PidfdFlags::empty()) {
2424
Ok(pidfd) => pidfd,
25-
Err(e) if e == io::Errno::NOSYS => {
25+
Err(io::Errno::NOSYS) => {
2626
// The kernel does not support pidfds.
2727
return;
2828
}
@@ -59,7 +59,7 @@ fn test_pidfd_poll() {
5959
let pid = process::Pid::from_child(&child);
6060
let pidfd = match process::pidfd_open(pid, process::PidfdFlags::NONBLOCK) {
6161
Ok(pidfd) => pidfd,
62-
Err(e) if e == io::Errno::NOSYS || e == io::Errno::INVAL => {
62+
Err(io::Errno::NOSYS) | Err(io::Errno::INVAL) => {
6363
// The kernel does not support non-blocking pidfds.
6464
return;
6565
}

0 commit comments

Comments
 (0)