summaryrefslogtreecommitdiff
path: root/src/sys/mman.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2018-12-08 13:47:33 -0700
committerAlan Somers <asomers@gmail.com>2018-12-08 13:51:43 -0700
commitca035734df2e3dfeb866cbfee51de7b582be83f5 (patch)
treedbbf94ee5189b13ea4d448ba63512b43f85b4ba8 /src/sys/mman.rs
parent5a3ac8df3fa2de86477d961d8b5720b1d283b2d5 (diff)
downloadnix-ca035734df2e3dfeb866cbfee51de7b582be83f5.zip
Replace try! with ?
try! is not available in Rust 2018
Diffstat (limited to 'src/sys/mman.rs')
-rw-r--r--src/sys/mman.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sys/mman.rs b/src/sys/mman.rs
index 48b5767e..a30629db 100644
--- a/src/sys/mman.rs
+++ b/src/sys/mman.rs
@@ -264,7 +264,7 @@ pub unsafe fn msync(addr: *mut c_void, length: size_t, flags: MsFlags) -> Result
#[cfg(not(target_os = "android"))]
pub fn shm_open<P: ?Sized + NixPath>(name: &P, flag: OFlag, mode: Mode) -> Result<RawFd> {
- let ret = try!(name.with_nix_path(|cstr| {
+ let ret = name.with_nix_path(|cstr| {
#[cfg(any(target_os = "macos", target_os = "ios"))]
unsafe {
libc::shm_open(cstr.as_ptr(), flag.bits(), mode.bits() as libc::c_uint)
@@ -273,16 +273,16 @@ pub fn shm_open<P: ?Sized + NixPath>(name: &P, flag: OFlag, mode: Mode) -> Resul
unsafe {
libc::shm_open(cstr.as_ptr(), flag.bits(), mode.bits() as libc::mode_t)
}
- }));
+ })?;
Errno::result(ret)
}
#[cfg(not(target_os = "android"))]
pub fn shm_unlink<P: ?Sized + NixPath>(name: &P) -> Result<()> {
- let ret = try!(name.with_nix_path(|cstr| {
+ let ret = name.with_nix_path(|cstr| {
unsafe { libc::shm_unlink(cstr.as_ptr()) }
- }));
+ })?;
Errno::result(ret).map(drop)
}