summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryant Mairs <bryantmairs@google.com>2017-12-16 08:57:19 -0800
committerBryant Mairs <bryantmairs@google.com>2017-12-20 07:05:04 -0800
commitd53ec4c6776daf18dff54991cd474256253ac7d8 (patch)
tree4a36f760a5a415dadb98469a11ab49c098b56b01
parent0d6770baf3901f98a2203051860011beb663ee84 (diff)
downloadnix-d53ec4c6776daf18dff54991cd474256253ac7d8.zip
Merge redundant match arms
-rw-r--r--src/errno.rs6
-rw-r--r--src/sys/signalfd.rs3
-rw-r--r--src/sys/socket/addr.rs3
-rw-r--r--src/sys/wait.rs13
4 files changed, 6 insertions, 19 deletions
diff --git a/src/errno.rs b/src/errno.rs
index 1f88ec78..2d0ad6c9 100644
--- a/src/errno.rs
+++ b/src/errno.rs
@@ -675,7 +675,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
@@ -940,7 +939,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
@@ -1168,7 +1166,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
@@ -1391,7 +1388,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
@@ -1607,7 +1603,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
@@ -1819,7 +1814,6 @@ mod consts {
use self::Errno::*;
match e {
- 0 => UnknownErrno,
libc::EPERM => EPERM,
libc::ENOENT => ENOENT,
libc::ESRCH => ESRCH,
diff --git a/src/sys/signalfd.rs b/src/sys/signalfd.rs
index 0da9187e..52027d36 100644
--- a/src/sys/signalfd.rs
+++ b/src/sys/signalfd.rs
@@ -127,8 +127,7 @@ impl Iterator for SignalFd {
fn next(&mut self) -> Option<Self::Item> {
match self.read_signal() {
Ok(Some(sig)) => Some(sig),
- Ok(None) => None,
- Err(..) => None,
+ Ok(None) | Err(_) => None,
}
}
}
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs
index b479c9cd..0130d2c0 100644
--- a/src/sys/socket/addr.rs
+++ b/src/sys/socket/addr.rs
@@ -750,8 +750,7 @@ impl SockAddr {
SysControlAddr(*(addr as *const sys_control::sockaddr_ctl)))),
// Other address families are currently not supported and simply yield a None
// entry instead of a proper conversion to a `SockAddr`.
- Some(_) => None,
- None => None,
+ Some(_) | None => None,
}
}
}
diff --git a/src/sys/wait.rs b/src/sys/wait.rs
index ba5dc27a..53c6a5f2 100644
--- a/src/sys/wait.rs
+++ b/src/sys/wait.rs
@@ -104,16 +104,11 @@ impl WaitStatus {
pub fn pid(&self) -> Option<Pid> {
use self::WaitStatus::*;
match *self {
- Exited(p, _) => Some(p),
- Signaled(p, _, _) => Some(p),
- Stopped(p, _) => Some(p),
- Continued(p) => Some(p),
+ Exited(p, _) | Signaled(p, _, _) |
+ Stopped(p, _) | Continued(p) => Some(p),
StillAlive => None,
-
- #[cfg(any(target_os = "linux", target_os = "android"))]
- PtraceEvent(p, _, _) => Some(p),
- #[cfg(any(target_os = "linux", target_os = "android"))]
- PtraceSyscall(p) => Some(p),
+ #[cfg(any(target_os = "android", target_os = "linux"))]
+ PtraceEvent(p, _, _) | PtraceSyscall(p) => Some(p),
}
}
}