From 4ffdba3ea61b3602ba25ba2c0dcfe794fa9ee2b0 Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 16 Mar 2016 00:20:45 +0100 Subject: [PATCH] minor style fixes --- src/os/mod.rs | 7 ++++--- src/os/sys/unix.rs | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/os/mod.rs b/src/os/mod.rs index 517d138..3e238ad 100644 --- a/src/os/mod.rs +++ b/src/os/mod.rs @@ -36,9 +36,10 @@ impl Stack { Stack { ptr: ptr as *mut u8, len: len } }; - try!(unsafe { - if sys::protect_stack(stack.ptr) { Ok(()) } - else { Err(IoError::last_os_error()) } + try!(if unsafe { sys::protect_stack(stack.ptr) } { + Ok(()) + } else { + Err(IoError::last_os_error()) }); Ok(stack) diff --git a/src/os/sys/unix.rs b/src/os/sys/unix.rs index c3d3b64..e2a41af 100644 --- a/src/os/sys/unix.rs +++ b/src/os/sys/unix.rs @@ -32,11 +32,10 @@ const STACK_FLAGS: c_int = libc::MAP_PRIVATE pub unsafe fn map_stack(len: usize) -> Option<*mut u8> { let ptr = mmap(ptr::null_mut(), len as size_t, STACK_PROT, STACK_FLAGS, -1, 0); - if ptr != MAP_FAILED { - Some(ptr as *mut u8) - } - else { + if ptr == MAP_FAILED { None + } else { + Some(ptr as *mut u8) } }