summaryrefslogtreecommitdiff
path: root/src/sys/signal.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/signal.rs')
-rw-r--r--src/sys/signal.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/sys/signal.rs b/src/sys/signal.rs
index f82e4502..d295abcc 100644
--- a/src/sys/signal.rs
+++ b/src/sys/signal.rs
@@ -34,7 +34,7 @@ libc_enum!{
SIGPIPE,
SIGALRM,
SIGTERM,
- #[cfg(all(any(target_os = "android", target_os = "emscripten", target_os = "linux"),
+ #[cfg(all(any(target_os = "android", target_os = "emscripten", target_os = "linux"),
not(any(target_arch = "mips", target_arch = "mips64"))))]
SIGSTKFLT,
SIGCHLD,
@@ -191,9 +191,10 @@ impl Signal {
// implemented, we'll replace this function.
#[inline]
pub fn from_c_int(signum: libc::c_int) -> Result<Signal> {
- match 0 < signum && signum < NSIG {
- true => Ok(unsafe { mem::transmute(signum) }),
- false => Err(Error::invalid_argument()),
+ if 0 < signum && signum < NSIG {
+ Ok(unsafe { mem::transmute(signum) })
+ } else {
+ Err(Error::invalid_argument())
}
}
}
@@ -423,8 +424,8 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result<SigActi
///
/// If both `set` and `oldset` is None, this function is a no-op.
///
-/// For more information, visit the [pthread_sigmask](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html),
-/// or [sigprocmask](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html) man pages.
+/// For more information, visit the [`pthread_sigmask`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html),
+/// or [`sigprocmask`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html) man pages.
pub fn pthread_sigmask(how: SigmaskHow,
set: Option<&SigSet>,
oldset: Option<&mut SigSet>) -> Result<()> {
@@ -435,9 +436,9 @@ pub fn pthread_sigmask(how: SigmaskHow,
let res = unsafe {
// if set or oldset is None, pass in null pointers instead
libc::pthread_sigmask(how as libc::c_int,
- set.map_or_else(|| ptr::null::<libc::sigset_t>(),
+ set.map_or_else(ptr::null::<libc::sigset_t>,
|s| &s.sigset as *const libc::sigset_t),
- oldset.map_or_else(|| ptr::null_mut::<libc::sigset_t>(),
+ oldset.map_or_else(ptr::null_mut::<libc::sigset_t>,
|os| &mut os.sigset as *mut libc::sigset_t))
};
@@ -560,8 +561,8 @@ mod sigevent {
#[cfg(any(target_os = "freebsd", target_os = "linux"))]
fn set_tid(sev: &mut libc::sigevent, sigev_notify: &SigevNotify) {
- sev.sigev_notify_thread_id = match sigev_notify {
- &SigevNotify::SigevThreadId { thread_id, .. } => thread_id,
+ sev.sigev_notify_thread_id = match *sigev_notify {
+ SigevNotify::SigevThreadId { thread_id, .. } => thread_id,
_ => 0 as type_of_thread_id
};
}
@@ -599,7 +600,7 @@ mod sigevent {
impl<'a> From<&'a libc::sigevent> for SigEvent {
fn from(sigevent: &libc::sigevent) -> Self {
- SigEvent{ sigevent: sigevent.clone() }
+ SigEvent{ sigevent: *sigevent }
}
}
}